Virtual Developer Workshop: Containerized Development with Docker

This article was contributed by Mark Findlay.

The credits dialog is a neat way to display a scrolling credits window like you see in the movies or in some of the Microsoft product credits that popup when you hit a hidden key sequence.

This dialog displays text in user defined colors and fonts and also displays bitmaps in the scrolling display! You simply type the text you wish to appear in the static array defined in the cpp file and use user defined escape sequences to designate different fonts, colors etc.

You can have a spiffy looking credits window in about 10 minutes!

The credits go through their cycle and wrap around to the beginning again for a never ending show!


  1. Create a dialog using the resource editor and set its style to WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION Put an OK button on it so the user has a way of dismissing the dialog.
  2. Create the credits display window (make it a good large size :) as a text box. Call the text box IDC_DISPLAY_STATIC (or whatever name you like, but if you use a different name you will need to change the IDC_DISPLAY_STATIC name used in the source code provided here.
  3. Use the ClassWizard to generate a class wrapper for the dialog. For purposes of this example we will use the names credits.cpp and credits.h as the files generated by the class wizard and CCredits as the class name to generate. Base the class on CDialog.
  4. Add the following data members to the credits.h file (or copy and paste them from the credits.h file provided)
    	#define DISPLAY_TIMER_ID		150		 timer id
     	RECT		m_ScrollRect,r;			// rect of Static Text frame
    	int		nArrIndex,nCounter;		// work ints
    	CString		m_szWork;			// holds display line
    	BOOL		m_bFirstTime;			// first time boolean
    	BOOL		m_bDrawText;			// drawing text or bitmap?
    	int		nClip;				// clip amount
    	int		nCurrentFontHeight;		// current font height
    	CWnd*		m_pDisplayFrame;		// output display wnd
    	CBitmap		m_bmpPIE;
    	CBitmap		m_bmpWork;
    	CBitmap* 	pBmpOld;
    	CBitmap*	m_bmpCurrent;
    	HBITMAP 	m_hBmpOld;
    	CSize 		m_size;
    	CPoint 		m_pt;
    	BITMAP 		m_bmpInfo;
    	CDC 		m_dcMem;
    	BOOL 		m_bProcessingBitmap;
  5. Create the following message handlers and functions using the class wizard:
    	virtual void OnOK();
    	afx_msg void OnPaint();
    	virtual BOOL OnInitDialog();
    	afx_msg void OnTimer(UINT nIDEvent);
    	afx_msg void OnDestroy();
  6. Cut and paste the functions from the credits.cpp file provided into your newly created functions.
  7. From another module (your About... dialog perhaps) , invoke the credits dialog:
    	CCredits dlgCredits;
Download source files. 48KB.


  • Scrolling Display

    Posted by Legacy on 06/27/2002 07:00am

    Originally posted by: rajeev

    I am working in ATL and I want to make a scrolling display.The display will be in a edit box . How do I do it in ATL??The edit box is a part of dialog box.

  • How to scroll and change the font, color of the scrolling text simultaneously?

    Posted by Legacy on 04/25/2001 07:00am

    Originally posted by: Nita

    My class derived from form view has the controls for changing the font, color etc. of text which is scrolling.
    I have created a modeless dialog within a thread spawned in a message handler function in view class to perform scrolling. I am having a problem in performing the scrolling & changing the font size etc in the view together.

  • When you load a 2nd dialog, how do you make it show in taskbar?

    Posted by Legacy on 10/22/2000 07:00am

    Originally posted by: Jack

    My project has 2 dialogs and when the user clicks on a button I want the 2nd dialog to open and the first to close. I can do this fine except the 2nd dialog doesn't have an icon and doesn't show in the windows task bar. Any suggestions?

  • Repaint does not correct display when another window damages a portion of the dialog

    Posted by Legacy on 09/07/2000 07:00am

    Originally posted by: Sinisa Ruzin

    First of all, thank you for the great example!
    I noticed that the dialog does not get repainted when another window (like Internet Explorer) moves over parts of the Credits Dialog. I tried to use virtual window to hold actual drawings and copy its bitmap to the dialog in the OnPaint() event, but since I am a beginner, this was too difficult for me to resolve.

    Could someone help?

    Thanks in advance,

  • How to add the scrolling credits to the About dialog instead to another dialog?

    Posted by Legacy on 08/16/2000 07:00am

    Originally posted by: Dini Dahm

    Does anyone know how to add the scrolling credits to the About dialog instead of to another dialog?  

  • Credit Dialog

    Posted by Legacy on 07/31/2000 07:00am

    Originally posted by: sujeet

    Yesss....it works cooool.

  • I cant get it to work

    Posted by Legacy on 01/29/2000 08:00am

    Originally posted by: Jed

    Help please. I am new at Visual C++ and i cant get it to work on my application. if you can help me please e-mail me at jed2010@erols.com or Jtdfx on AOL

  • missing a OnEraseBkgnd treatment

    Posted by Legacy on 10/26/1999 07:00am

    Originally posted by: Pedro Soares

    when another dialog goes in front of the credits frame and then this one gains the focus, the image of the frame isnt repainted! :(

  • It's great, just one question.

    Posted by Legacy on 05/22/1999 07:00am

    Originally posted by: Jason M. Greene

    How can I make it so that the company name is a link to a web site?


    Posted by Legacy on 03/05/1999 08:00am

    Originally posted by: Talal Tayyab

    I have tried to use it in a Dialog based Application created by the MFC
    Application Wizard and nothing seems to happen..
    Could somebody Please Help ME!!!!!!!!
    (p.s I have done every step and the program also compiles)
    E-mail: love_ntt@yahoo.com

  • Loading, Please Wait ...

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date