65.9K
CodeProject is changing. Read more.
Home

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

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.33/5 (20 votes)

Apr 25, 2004

2 min read

viewsIcon

83828

downloadIcon

2937

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