DWORD WINAPI SplashScreen(HBITMAP hSplashBitmap) { RegisterSplashScreenWndClass(); HWND splashWindow = ShowSplashScreenWindow(hSplashBitmap); MSG msg; while (true) { while (PeekMessage(&msg, splashWindow, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } Sleep(50); HWND hNewWindow = NULL; EnumWindows(EnumWindowsProc, (LPARAM)&hNewWindow); if (hNewWindow) { BringWindowToTop(hNewWindow); Sleep(100); DeleteObject(hSplashBitmap); DestroyWindow(splashWindow); break; } if (!IsParentProcessRunning(parentProcHandle)) break; } return 0; }
DWORD WINAPI SplashScreenThread(LPVOID args) { HBITMAP hSplashBitmap = static_cast<HBITMAP>(args); RegisterSplashScreenWndClass(); HWND splashWindow = ShowSplashScreenWindow(hSplashBitmap); MSG msg; while(true) { while (PeekMessage(&msg, splashWindow, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } Sleep(50); HWND hNewWindow = NULL; EnumWindows(EnumWindowsProc, (LPARAM) &hNewWindow); if (hNewWindow) { BringWindowToTop(hNewWindow); DeleteObject(hSplashBitmap); DestroyWindow(splashWindow); } } return 0; }