You forgot the message pump in your WinMain
while ( GetMessage(&msg, NULL, 0, 0) )
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
and in your WindowProcedure you forgot the return value
return DefWindowProc(hWnd, message, wParam, lParam);
WinMain does not return until window is destroyed