Click here to Skip to main content
15,070,111 members
Articles / Desktop Programming / MFC
Posted 15 Dec 1999


93 bookmarked

Adding a splash screen to your dialog based application

Rate me:
Please Sign up or sign in to vote.
4.57/5 (24 votes)
8 Aug 2002
Splash screens are not only for Doc/View based applications
Image 1 This article including source code copyright © 2001 Codejock Software, All Rights Reserved.  Feel free to use any of the source code found in this article without restriction.


If you have ever created a dialog application, and then tried to add a splash screen using the splash screen component, you may have found out that it won't allow you to.  This article is a quick tip for adding a splash to your dialog application using the CSplashWnd class.  This class is an enhanced version of the one that is normally generated by the splash component for a document view project.

Image 2

In order to use the CSplashWnd in our dialog based application, we will have to override three functions, CDialog::OnInitDialog(), CWinApp::InitInstance() and

CWinApp::PreTranslateMessage(MSG* pMsg)
OnInitDialog and
should have already been added to your project when you created it if you used the AppWizard, however you may have to add
to your CWinApp derived class.

Step 1:

Add the following line of code to your CDialog::OnInitDialog method just before it looses scope.  The first argument to ShowSplashScreen is the time out value in milliseconds, this is how long the splash screen will be displayed before it closes.  The second argument is the resource identifier of the bitmap image that we will be using as the splash screen. The last argument is the parent window, this parameter can be NULL.

// Create and show the splash screen.
CSplashWnd::ShowSplashScreen(3000, IDB_SPLASH24, this);

Step 2:

Add the following line of code, toward the very beginning of the CWinApp::InitInstance, just after the call ParseCommandLine(...).  You will need to add ParseCommandLine if it is not already included.

// Enable the splash screen component based on the command line info.
CCommandLineInfo cmdInfo;


Step 3:
Use Class Wizard to override CWinApp::PreTranslateMessage(MSG* pMsg), and add the following lines of code:

BOOL CMyApp::PreTranslateMessage(MSG* pMsg) 
    // Route messages to the splash screen while it is visible
    if (CSplashWnd::PreTranslateAppMessage(pMsg)) {
        return TRUE;
    return CWinApp::PreTranslateMessage(pMsg);


9 Aug 2002 - rewritten extensively.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Kirk Stowell
CEO Codejock Technologies, LLC
United States United States
No Biography provided
Group type: Organisation (No members)

Comments and Discussions

Generaldynamic splash screen Pin
shital_harode@rediffmail.com2-Nov-06 0:40
Membershital_harode@rediffmail.com2-Nov-06 0:40 
GeneralEmbedded JPG || GIF Pin
ArvinB19-Oct-06 9:16
MemberArvinB19-Oct-06 9:16 
GeneralRe: Embedded JPG || GIF Pin
gopalcdas24-Sep-08 23:17
Membergopalcdas24-Sep-08 23:17 
QuestionCopyrighted ? Pin
toxcct30-Jun-05 6:10
Membertoxcct30-Jun-05 6:10 
AnswerRe: Copyrighted ? Pin
David Wulff30-Jun-05 6:40
MemberDavid Wulff30-Jun-05 6:40 
GeneralGet SplashScreen to Close Programatticaly Pin
Richard Males3-Oct-04 13:17
MemberRichard Males3-Oct-04 13:17 
GeneralRe: Get SplashScreen to Close Programatticaly Pin
RWThompson24-Oct-04 9:36
MemberRWThompson24-Oct-04 9:36 
QuestionShowing Splash before creating CMainframe? Pin
Miguel Lopes25-Feb-04 3:02
MemberMiguel Lopes25-Feb-04 3:02 
Generaldynamic splash screen Pin
Corey W16-Jan-04 15:53
MemberCorey W16-Jan-04 15:53 
GeneralRe: dynamic splash screen Pin
Cokeisit21-Apr-04 2:08
MemberCokeisit21-Apr-04 2:08 
GeneralRe: dynamic splash screen Pin
Member 116714020-Jun-04 21:39
MemberMember 116714020-Jun-04 21:39 
GeneralRe: dynamic splash screen Pin
Cokeisit3-Jul-04 5:42
MemberCokeisit3-Jul-04 5:42 
GeneralPrevent mouse clicks Pin
Cokeisit16-Dec-03 3:19
MemberCokeisit16-Dec-03 3:19 
GeneralModifications Pin
matty15920-Mar-03 4:20
Membermatty15920-Mar-03 4:20 
GeneralRe: Modifications Pin
Cokeisit16-Dec-03 3:14
MemberCokeisit16-Dec-03 3:14 
GeneralRe: Modifications Pin
vijayvinoth19-Sep-10 2:05
Membervijayvinoth19-Sep-10 2:05 
Generalvery nice Pin
arnaba19-Jan-03 9:13
Memberarnaba19-Jan-03 9:13 
GeneralCool! Pin
Selevercin14-Dec-02 14:05
MemberSelevercin14-Dec-02 14:05 
Generalchange sample file Pin
Mazdak20-Aug-02 2:29
MemberMazdak20-Aug-02 2:29 
GeneralUnflappability Pin
Anonymous10-Aug-02 18:29
MemberAnonymous10-Aug-02 18:29 
GeneralRe: Unflappability Pin
Rashid Thadha11-Aug-02 1:51
MemberRashid Thadha11-Aug-02 1:51 
GeneralKirk don't let these losers get at you Pin
NormDroid10-Aug-02 8:02
professionalNormDroid10-Aug-02 8:02 
GeneralRe: Kirk don't let these losers get at you Pin
Michael A. Barnhart10-Aug-02 16:42
MemberMichael A. Barnhart10-Aug-02 16:42 
GeneralPoor!! This is not English! Pin
supertedusa24-Jun-02 3:42
Membersupertedusa24-Jun-02 3:42 
GeneralFIX: splash wnd closed on mouse click Pin
17-Mar-02 23:15
suss17-Mar-02 23:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.