Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Splash Window

Posted on 1999-06-24
Medium Priority
Last Modified: 2013-12-03
Can you show me a sample program in creating a simple splash window using C?
Question by:prachel
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 1401072
If you are using Visual C++ and MFC create your program using APP Wizard, then select from menu Project->Add to Project->Components and controls->Visual C++ Components-> Splash Screen. This will add Splash Screen to your project

Accepted Solution

jessicalim earned 80 total points
ID: 1401073
You just have to create a windows and create a bitmap resource in the resource file. Be careful of the HINSTANCE that you are aasigned to the WNDCLASS.  

In the SplashProc, in the case WM_CREATE:, load the bitmap which you want to display in the Splash Window by using LoadBitMap.

You can display your bitmap in case WM_PAINT:. First, you must obtain the device context so that the bitmap can output to the window. Second, obtain an equivalent memory device context that will hold the bitmap until it is displayed. Third, select the bitmap into the memory device context n now you can copy ypur bitmap from the memory device context to the window device context.

Here's some example of the source code:
HWND SplashWnd;

// in resource file
MyBP BITMAP "filename"

//in SplashProc
HDC hdc, memdc;

   hbit = LoadBitmap(hInst, "MyBP ");      
case WM_PAINT :
   hdc = GetDC (hSplashWnd);
   BeginPaint(hdc , &ps);
   memDC = CreateCompatibleDC (hdc );
   SelectObject (memdc,hbit);
   BitBlt (hdc, LOWORD (lParam), HIWORD (lParam), 640, 480, memdc, 0, 0,                     SRCCOPY);
   EndPaint(hdc, &ps);


Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question