-
Windows Programming
I only have one error in my code and I dont know why it is wrong!
(I have not run the code, but the part that is underlined in red sais:
A value of type "long" cannot be used to initialize an entitity of type "HWND")
All i am trying to do is create a window.
Here is the part with the error. Its where I create a window.
Code:
HWND WINAPI CreateWindowEx(
WS_EX_CLIENTEDGE,
g_szClassName,
"The title of my window",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 240, 120,
NULL, NULL, hInstance, NULL);
if(hwnd == NULL)
{
MessageBox(NULL, "Window Creation Failed!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
return 0;
}
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
How do I fix this?
-
SORRY! I fixed the problem.
-
The HWND WINAPI part is from the declaration of CreateWindowEx. Why did you put it in the call? It should be something like:
Code:
HWND hwnd = CreateWindowEx(...)
For future reference, we have a forum specific to Windows programming. Use it. (I didn't move this thread because it's not really about Windows programming, and more about function usage.)
Also, it would be helpful if you pointed out exactly which line is underlined.
-
Ya, I did that just before you posted.
Anyway, sorry about posting here, I didnt see the other forum. Ill use it next time.
-
Is there a reason you are using the Win32 API instead of, say, Qt?