Game Development Reference
In-Depth Information
0,
0,
instanceHandle,
0);
if(MainWindowHandle == 0)
{
::MessageBox(0, "CreateWindow - Failed", 0, 0);
return false;
}
// Finally we show and update the window we just created.
// Observe we pass MainWindowHandle to these functions so
// that these functions know what particular window to
// show and update.
::ShowWindow(MainWindowHandle, show);
::UpdateWindow(MainWindowHandle);
return true;
}
int Run()
{
MSG msg;
::ZeroMemory(&msg, sizeof(MSG));
// Loop until we get a WM_QUIT message. The
// function GetMessage will only return 0 (false)
// when a WM_QUIT message is received, which
// effectively exits the loop.
while(::GetMessage(&msg, 0, 0, 0) )
{
// Translate the message, and then dispatch it
// to the appropriate window procedure.
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND windowHandle,
UINT msg,
WPARAM wParam,
LPARAM lParam)
{
// Handle some specific messages:
switch( msg )
{
// In the case the left mouse button was pressed,
// then display a message box.
case WM_LBUTTONDOWN:
::MessageBox(0, "Hello, World", "Hello", MB_OK);
return 0;
// In the case the escape key was pressed, then
Search WWH ::




Custom Search