Exemple #1
0
int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR commandLine, int cmdShow)
{
    if( !COverlappedWindow::RegisterClass() ) {
        return -1;
    }
    COverlappedWindow window;
    if( !window.Create() ) {
        return -1;
    }
    window.Show(cmdShow);
    HACCEL acceleratorHandle = ::LoadAccelerators(GetModuleHandle(0), MAKEINTRESOURCE(IDR_ACCELERATOR1));

    MSG message;
    BOOL getMessageResult = 0;
    while( getMessageResult = ::GetMessage(&message, 0, 0, 0) ) {
        if( getMessageResult == -1 ) {
            return -1;
        } else {
            if( !TranslateAccelerator(window.Handle(), acceleratorHandle, &message) ) {
                ::TranslateMessage(&message);
                ::DispatchMessage(&message);
            }
        }
    }
    return 0;
}
int _stdcall wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR commandLine, int nCmdShow ) {
	if ( !COverlappedWindow::RegisterClass(hInstance) ) {
		return 1;
	}

	COverlappedWindow myWin;
	
	if ( !myWin.Create(hInstance) ) {
		return 1;
	}

	myWin.Show(nCmdShow);

	HACCEL haccel = ::LoadAccelerators( hInstance, MAKEINTRESOURCE( IDR_ACCELERATOR1 ) );

	MSG message;
	BOOL getMessageResult = 0;
	while( ( getMessageResult = ::GetMessage( &message, NULL, 0, 0 ) ) != 0 ) {
		if ( getMessageResult == -1 ) {
			return -1;
		}
		if( !::TranslateAccelerator( myWin.GetHandle(), haccel, &message ) ) {
			::TranslateMessage( &message );
			::DispatchMessage( &message );
		}
	}

	return message.wParam;
}
Exemple #3
0
int WINAPI wWinMain(HINSTANCE hInstance, 
	HINSTANCE hPrevInstance,
	LPWSTR szCmdLine, 
	int cmdShow)
{
	const wchar_t className[] = L"myPrettyParentClass";

	COverlappedWindow myWindow;

	myWindow.RegisterClass(hInstance, className);

	myWindow.Create(hInstance, className);

	myWindow.Show(cmdShow);

	return 0;
}
Exemple #4
0
int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPWSTR commandLine, int cmdShow) {

	if (!COverlappedWindow::RegisterClass()) {
		return -1;
	}

	COverlappedWindow window;
	if (!window.Create()) {
		return -1;
	}
	window.Show(cmdShow);
	MSG message;
	BOOL getMessageResultCode = 0;
	while ((getMessageResultCode = ::GetMessage(&message, 0, 0, 0)) != 0) {
		if (getMessageResultCode == -1) {
			return -1;
		}
		::TranslateMessage(&message);
		::DispatchMessage(&message);
	}
	return 0;
}