i dont understand! i spent more than 2 hours trying to fix this program...for now it should just create a window...i wrote the code myself from what i remembered...and when i compare it to other similar examples....could anyone please tell me what i forgot?
thanks in advance!
Let's see:
1) You shouldn't call your global HWND variable hwnd, as it is the same name you used in WndProc (no error, just not good)
2) I don't think WS_BORDER is an extended window style as they all begin with WS_EX_
3) I think you have to handle the WM_CREATE message, but I#m not absolutely sure.
4) You didn't assign a value to wc.hIconSm. This can cause RegisterWindowEx to fail. If you don't want to use it, use WNDCLASS and RegisterClass instead (Petzold does this, btw)
5) GetMessage(&msg, hwnd, NULL, NULL)
This can cause one of the nastiest errors I know. Since this will only receive messages targeted at hwnd, it will not get the WM_QUIT message (that is targeted on no window) and therefor never leave the message loop, even after the widow was destroyed. The program will run on forever, so you can't (for example) recompile it. Use GetMessage(&msg, NULL, 0, 0) > 0 to receive every message in your app and even be save from the GetMessage error return (-1).
6) I think the main problem is that you forgot the calls to ShowWindow and UpdateWindow
All the buzzt CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.