Commit 1f0a4498 authored by chili's avatar chili
Browse files

baby's first wndproc

parent 8a97ca31
#include <Windows.h>
LRESULT CALLBACK WndProc( HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam )
{
switch( msg )
{
case WM_CLOSE:
PostQuitMessage( 69 );
break;
}
return DefWindowProc( hWnd,msg,wParam,lParam );
}
int CALLBACK WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
......@@ -11,7 +23,7 @@ int CALLBACK WinMain(
WNDCLASSEX wc = { 0 };
wc.cbSize = sizeof( wc );
wc.style = CS_OWNDC;
wc.lpfnWndProc = DefWindowProc;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
......@@ -35,11 +47,19 @@ int CALLBACK WinMain(
// message pump
MSG msg;
while( GetMessage( &msg,nullptr,0,0 ) > 0 )
BOOL gResult;
while( (gResult = GetMessage( &msg,nullptr,0,0 )) > 0 )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
return 0;
if( gResult == -1 )
{
return -1;
}
else
{
return msg.wParam;
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment