| theranga (100) | |||||
I'm setting up a window class and registering, like so:
and it gives me the output:
On msdn (http://msdn.microsoft.com/en-us/library/windows/desktop/ms681384%28v=vs.85%29.aspx), it says:
What does this mean and how can I fix it? EDIT: when I use this class in CreateWindowEx("big_window_class",...), it returns NULL but GetLastError() returns 0
| |||||
|
Last edited on
|
|||||
| freddie1 (847) | |||||
Is there code I'm not seeing? I see a function prototype ...
... for a mainWindow function, but I see no mainWindow function? iostream will do you no good. If you want to know what a Windows program looks like, take a look at this minimal one. Take especial note of the fact that while I have no prototype for a Window Procedure, I do indeed have one, i.e., fnWndProc. And the address of that existing function is passed into Windows through the lpfnWndProc member of WNDCLASSEX::lpfnWndProc. The below code will only compile as an ansi build...
Also, don't use global data. Its no good. Put your WNDCLASSEX object declaration in WinMain(), not in your program's data segment. | |||||
|
Last edited on
|
|||||
| EssGeEich (1007) | |
|
The result of RegisterClassEx is an ATOM which is a numeric ID of the class. If it fails, it returns 0. http://msdn.microsoft.com/en-us/library/windows/desktop/ms633587(v=vs.85).aspx | |
|
Last edited on
|
|
| theranga (100) | |
|
@freddie1: that function prototype is just for the window procedure I think the problem is line 16, where it gives a handle to something that isn't a brush - this would explain the error (the resource given in (HBRUSH)COLOR_BACKGROUND doesn't exist) | |
|
Last edited on
|
|
| theranga (100) | |
| That was the problem after all. Thanks people for your input! | |
|
|
|