Click here to Skip to main content
15,885,365 members
Articles / Desktop Programming / MFC
Article

Splash screen with contents of the <b>VERSIONINFO</b>

Rate me:
Please Sign up or sign in to vote.
4.33/5 (24 votes)
24 Apr 20042 min read 83.1K   2.9K   34   11
Easy to implement splash screen for dialog based applications that <b>displays the contents of VERSIONINFO</b>. Look at this!

Sample Image - CSplashWnd_Extended.gif

Credits

This Splash screen is a composite:

  • CSplashWnd comes from CODEJOCK Software
  • CModuleVersion comes from Paul DiLascia / Microsoft Systems Journal 1998

Both of the above classes are edited (more or less) to suit my needs.

Introduction

With one simple call to a static function, you are able to show a Splash screen in your Dialog based application. The Splash screen gets its information out of the VERSIONINFO which is filled in by you.

Using the code

If you're not already finished with it, fill in the VERSIONINFO of your resources:

  1. Add:
    #include "SplashWnd.h"
  2. Add the virtual function PreTranslateMessage(MSG* pMsg) to your Main Dialog class and paste the following code to the function body:
    // Route messages to the splash screen while it is visible
    if(CSplashWnd::PreTranslateAppMessage(pMsg))
        {
            return TRUE;
        }
  3. Next,
    • 3.1. Call the static function
      SetInfo(BOOL bCompanyName, BOOL bCopyright, 
              BOOL bFileVersion, BOOL bProductName);

      in the OnInitDialog part of your Main Dialog class. The BOOLs tell the next function which of the four VERSIONINFOs should be used! In case you want to display all of the above mentioned information, just don't use this function.

    • 3.2 Call the static function
      CSplashWnd::ShowSplashScreen(UINT uTimeOut, 
                  UINT uBitmapID, CWnd* pParentWnd = NULL)

      in the OnInitDialog part of your Main Dialog class.

      • uTimeOut is the amount of time in milliseconds to display the Splash screen (if no other action occurs).
      • uBitmapID is the ID of the bitmap to display.
      • pParentWnd is the Parent window.

    Updated/added 28.04.2004:

  4. If you want to close the SplashScreen for whatever reason you have, call the static member.
    CSplashWnd::CloseSplashScreen()

    e.g.: call the function right before the end of OnInitDialog part of your Main Dialog class.

    That's all there is to do. If you want to change the text color, give the member COLORREF m_crTextCol of class CSplashWnd another value.

Some infos

I don't like messing around with image-editors, so I had the idea to display the version information which is already there. After some hours attempting to get the version information out of an executable, I looked in the Internet and found Paul DiLascia's very, very useful class. Then I used CODEJOCK's class and built support to display a Bitmap as background, stretch it if necessary (depends on the length of the information), and bring it all on the Bitmap.

It's like everything else. This class can be better, faster and maybe makes coffee. So feel free to change or add functions. Use this as a base for your own Splash screen or whatever.......

Have Phun! ;-)

History

  • Last update: 28.04.2004

License

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


Written By
Web Developer
Germany Germany
My name is Thomas, I'm born on January the 11th in
1970, right now I'm working in the Quality department
of a big Pipe mill as a Technician.
My hobbies are my girl friend, my car, RC-Planes and
Computers. I begun with VC++ some time ago and now
Programming is like a drug to me (I'm still a
beginner). I want to learn it all in a blink of an
eye Wink | ;-) but i know that this is not possible. It's
real fun for me and I do small Programms for my own
use.
O.K. enough written..... I need my Time to debug
everything that crosses my way! Wink | ;-)

Comments and Discussions

 
GeneralCOM,COM+,DCOM Pin
ciitpk30-Jul-04 2:40
ciitpk30-Jul-04 2:40 
GeneralRe: COM,COM+,DCOM Pin
Thomas Latuske30-Jul-04 5:33
Thomas Latuske30-Jul-04 5:33 
Generalit needs clicking... Pin
radumoiceanu27-Apr-04 14:23
radumoiceanu27-Apr-04 14:23 
good piece of work...
however, let's say you have an application that takes a variable amount of time to load. if you set a big timeout, the user has to click or hit a key so that the main window gets focus and the splash screen is destroyed... pretty annoying, trust me!
a little trick i did, and it seems to work, is to put the following code at the end of OnInitDialog(), right after everything is loaded and ready:

MSG m;
m.message = WM_KEYDOWN;
CSplashWnd::PreTranslateAppMessage(&m);

if (!bestpossible)
{
make_it_best();
}

GeneralRe: it needs clicking... Pin
Thomas Latuske28-Apr-04 6:53
Thomas Latuske28-Apr-04 6:53 
GeneralNo marquee please Pin
Thomas Freudenberg26-Apr-04 4:07
Thomas Freudenberg26-Apr-04 4:07 
GeneralRe: No marquee please Pin
Thomas Latuske26-Apr-04 7:05
Thomas Latuske26-Apr-04 7:05 
GeneralRe: No marquee please Pin
Thomas Freudenberg26-Apr-04 21:29
Thomas Freudenberg26-Apr-04 21:29 
GeneralGood Pin
ajhuddy25-Apr-04 18:40
ajhuddy25-Apr-04 18:40 
GeneralRe: Good Pin
Thomas Latuske26-Apr-04 7:04
Thomas Latuske26-Apr-04 7:04 
GeneralRe: Good Pin
Michael Pearce23-May-04 18:00
Michael Pearce23-May-04 18:00 
GeneralRe: Good Pin
Thomas Latuske24-May-04 7:48
Thomas Latuske24-May-04 7:48 

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.