I am practicing Win32 API again, and for some reason, I am getting an error.
#include <windows.h>
#include <windowsx.h>
#define WSIZE = 400
#define HSIZE = 400
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX wc;
HWND hWnd;
ZeroMemory(&wc, sizeof(WNDCLASSEX));
//wc.cbClsExtra =
wc.cbSize = sizeof(WNDCLASSEX);
//wc.cbWndExtra =
wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
//wc.hIcon =
//wc.hIconSm =
wc.hInstance = hInstance;
wc.lpfnWndProc = WndProc;
wc.lpszClassName = "MyWnd";
//wc.lpszMenuName =
wc.style = CS_HREDRAW | CS_VREDRAW;
RegisterClassEx(&wc);
//Error here, says syntax error: '=' when I say hWnd = CreateWindowEx etc...
hWnd = CreateWindowEx(NULL, "MyWnd", "My Win32 Window", WS_OVERLAPPEDWINDOW, 100, 100, WSIZE, HSIZE, NULL, NULL, hInstance, NULL);
ShowWindow(hWnd, nCmdShow);
MSG msg;
while(TRUE)
{
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
if(msg.message == WM_QUIT)
break;
}
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
}
break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}