Displaying a Splash Screen with C++ (Introduction)

Even the leanest and meanest WPF application has significant startup costs, especially in a cold start situation. There have been a number of posts describing how to display a splash screen as soon as possible (and a built-in method was introduced in .NET 3.5 SP1), but these solutions still incur the cost of loading a large part of the .NET Framework.

For pure speed, only native code will let you get a splash screen up as soon as the user double-clicks your application icon. (In fact, a splash screen application is so simple that you can further trim startup costs by avoiding the standard Visual C++ runtime libraries.) The following series of posts will detail the steps involved in using WIC and the UpdateLayeredWindow function to display a splash screen (with an alpha channel) using the Win32 API in C++.

Part I: Creating a HBITMAP

Part II: Displaying the Window

Part III: Launching the Application

Part IV: Dismissing the Splash Screen

Part V: Windows 7 Taskbar Compatibility

Update: Stefan Olson posted a Visual C++ project containing all the code in this series (with a few extra features, including fading out the splash screen and the ability to load from any file, not just application resources).

Posted by Bradley Grainger on September 22, 2008