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);
}

The problem is lines 4 and 5 are incorrect. Remove the = in those two lines.

Its not a snippet of copy pasted code. I wrote it word for word, but did not copy paste, and I do understand what is going on in the code because I have done it before a long time ago. Im just trying to figure out why it is saying I cant assign the return value from CreateWindowEx to my HWND variable.

Please re-read my previous post, which I just now changed.

Oh, its always something obvious. Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.