Splash Window

Can you show me a sample program in creating a simple splash window using C?
Who is Participating?
jessicalimConnect With a Mentor Commented:
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);

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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.