Link to home
Start Free TrialLog in
Avatar of Larry
Larry

asked on

Splash Screen in Dialog-Based Visual C++ Application

Reference MS Knowledge Base Article ID: Q190684
"HOWTO: Insert a Splash Screen into a Dialog-Based Application"

"The Visual Component Gallery allows one to insert a variety of standard components into applications.  Using the gallery, one can easily insert a splash screen into MFC SDI and MDI applications.  However, the Visual C++ Component Gallery does not allow insertion of a splash screen into a dialog-based application."

The above MS Knowledge Base article explains how to do it but it doesn't work.  The created dialog-based application compiles but does not display the splash screen.  HOW DO I DO IT?
***********************************************************
IF cwrea IS CORRECT, I AM INCORRECTLY COMPLETING STEP 6 OF THE MS KNOWLEDGE BASE INSTRUCTIONS.  WHEN I CHECK EXECUTION IN THE DEBUGGER, CSplashWnd::ShowSplashScreen(this) fails.  I imported a bitmap resource and renamed it IDB_SPLASH as instructed but the application doesn't seem to find it.

TO RECAP:  I AM RUNNING VISUAL C++ 6.0.  THE TEST DIALOG-BASED APPLICATION COMPILES WITHOUT ERROR BUT DOES NOT DISPLAY THE SPLASH WINDOW.  ONLY THE APPLICATION DIALOG BOX WITH CANCEL & OK BUTTONS APPEARS.  ANY CHANCE I COULD GET AN EMAIL COPY OF THE A RUNNING EXAMPLE.  EMAIL:lphull@anteon.com.  Thanks -- Larry
Avatar of ekc
ekc

Create a SDI application and generate splash screen component in it, the way it is normaly done.
Then copy the generated files "splash.h" and "splash.cpp",  to your dialog-based project and do the following modifications to it.

1. Add the

#include "splash.h"

on the tp of your dialog CPP file.

2. Add the following lines of code at the end of your OnInitDialog() function:

     CSplashWnd::EnableSplashScreen(TRUE);
     
     CSplashWnd::ShowSplashScreen(this);

3. Don't forget to add the BMP file (your splash screen visual interpretation) to the project via resource editor. Set its name to IDB_SPLASH (the name generated by wizard. You can change it, but then check this in the splash code)

4. Compile the project and enjoy your new splash. :)
ASKER CERTIFIED SOLUTION
Avatar of cwrea
cwrea
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Larry

ASKER

Thanks for guidance on adding a splash screen to a dialog-based Visual C++ application.  I finally got it running after a complete rebuild.