Exemplo n.º 1
0
bool Platform::displaySplashWindow( String path )
{
    if(path.isEmpty())
        return false;

#ifdef UNICODE
    const UTF16 *lFileName = path.utf16();
#else
    const UTF8  *lFileName = path.c_str();
#endif

    gSplashImage = (HBITMAP) ::LoadImage(0, lFileName,
                                         IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);

    if (!gSplashImage)
        return false;

    gSplashWnd = CreateSplashWindow(GetModuleHandle(NULL));

    if (!gSplashWnd)
        return false;

    SetSplashImage(gSplashWnd, gSplashImage);

    return true;
}
Exemplo n.º 2
0
bool Platform::displaySplashWindow()
{

	gSplashImage = (HBITMAP) ::LoadImage(0, L"art\\gui\\splash.bmp", 
		IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
	
	if (!gSplashImage)
		return false;

	gSplashWnd = CreateSplashWindow(GetModuleHandle(NULL));

	if (!gSplashWnd)
		return false;

	SetSplashImage(gSplashWnd, gSplashImage);

	return true;
}
Exemplo n.º 3
0
void CSplashScreen::Show() {
	CoInitialize(0);

	// create the named close splash screen event, making sure we're the first process to create it
	SetLastError(ERROR_SUCCESS);

	std::basic_string <TCHAR> strEvent1 = _T("CloseSplashScreenEvent")+m_strPrefix;
	HANDLE hCloseSplashEvent = CreateEvent(NULL, TRUE, FALSE, strEvent1.c_str());

	if (GetLastError() == ERROR_ALREADY_EXISTS) {
		ExitProcess(0);
	}

	std::basic_string <TCHAR> strEvent2 = _T("CloseSplashScreenWithoutFadeEvent")+m_strPrefix;
	HANDLE hCloseSplashWithoutFadeEvent = CreateEvent(NULL, TRUE, FALSE, strEvent2.c_str());
	if (GetLastError() == ERROR_ALREADY_EXISTS) {
		ExitProcess(0);
	}

	HBITMAP hb = m_pImgLoader->LoadSplashImage();
	HWND wnd= NULL;
	RegisterWindowClass();

	if (hb!=NULL) {
		wnd=CreateSplashWindow();
		SetSplashImage(wnd, hb);
	}

	// launch the WPF application
	HANDLE hProcess = LaunchWpfApplication();

	AllowSetForegroundWindow(GetProcessId(hProcess));

	if (wnd!=NULL) {
		// display the splash screen for as long as it's needed
		HANDLE aHandles[3] = { hProcess, hCloseSplashEvent, hCloseSplashWithoutFadeEvent };
		PumpMsgWaitForMultipleObjects(wnd, 3, &aHandles[0], INFINITE);
	}

	CloseHandle(hCloseSplashEvent);
	CloseHandle(hCloseSplashWithoutFadeEvent);

	UnregisterWindowClass();
}