This file won't build

  • Thread starter Thread starter Michael Bradley59
  • Start date Start date
M

Michael Bradley59

Guest
// Game.cpp

#include <windows.h>


LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);


HWND g_hWnd;



// WinMain()
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, INT)
{
WNDCLASS wc = { CS_CLASSDC, WndProc, 0, 0, hInstance, NULL, NULL, NULL, NULL, "Game" };
if (!RegisterClass(&wc)) return FALSE;
g_hWnd = CreateWindow("Game", "", WS_OVERLAPPEDWINDOW, 100, 100, 648, 514, GetDesktopWindow(), NULL, hInstance, NULL);
if (g_hWnd == NULL) return FALSE;
ShowWindow(g_hWnd, SW_SHOWDEFAULT);
MSG msg;
ZeroMemory(&msg, sizeof(MSG));
while (msg.message != WM_QUIT)
{
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
UnregisterClass("Game", hInstance);
return 0;
}

// WndProc()
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(hWnd, msg, wParam, lParam);
}
}

Continue reading...
 
Back
Top