Shows a splash screen with extra features:
- Enables dynamic writing of text on the splash-screen
- Enables dynamic displaying bitmaps transparently on the splash-screen
- All text-effects (text, sizes, fonts, positions) can be changed within a timer-procedure
This allows you to create “animated” splash-screens
- Uses a second thread, useful especially for long startup-time of application
How to use:
1. You have to create the spash within your CMainFrame::OnCreate().
Then, set bitmap, text and some other settings (text-positions and how long the splash
should appear) and call CreateThread().
That’s all. The thread is destroyed and deleted automatically!
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
CSplashThread *pThread = new CSplashThread();
// .. some other settings
pThread->SetTimerDuration(5000); // 5 seconds
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
2. If you want extra features, create your own thread-class derived from CSplashThread
(as done in the sample, download-size is 140 kB). Within this sample, the internal timer
is activated. Each timer resets the position of the Header-text and repaints the splash.
This creaes an animated splash-screen.
How it works:
* The splash-screen uses the class CSplashThread which is derived from CWinThread. The
splash-Window is created from the internal CSplashThread::InitInstance(). This function
is called when the thread is created with CWinThread::CreateThread().
* In InitInstance() the Splash-Window is created. Then the splash-window redirects some
important messages, like painting, timer, to the creating CSplashThread-class. This class
handles these messages.
* The thread is destroyed when the “finish-timer arrives” with SetTimerDuration(). It calls
HideSplashScreen() (you can call this function also directly, like in the sample).
HideSplashScreen() calls DestroyWindow() of the splash-window.
* If you want extras, just derive from the class and override some functions, as shown in the example.
* If you have enchancements to the code, mail to [email protected]
* The sample uses the function DrawTransparentBitmap(). The original code is from Q79212
and some places also here on www.codeguru.com. It is changed, because the code doesn’t
work with mapping-modes other than MM_TEXT
* There should be no reason for the code not working with unicode
* This code was build with MFC shipped with VC++5.0, Enterprise Edition, Service Pack 3
Last updated: 14 May 1998