either i'm an idiot or CreateWindowEx is an idiot. i'm willing to bet it's me since my whole day has been very much in the toilet. anyway, if i create a window of a certain class, CreateWindowEx fails and GetLastError returns 0 (error 0 = 'the operation completed successfully'). that alone doesn't make any sense to me. but if i use any other registered class, it works fine. what's the problem?
This message was edited by Sloat, on 2/20/2001 5:19:07 PM
... viewclass db "View",0 ... mov wc.cbSize, sizeof(WNDCLASSEX) mov wc.style, CS_HREDRAW or CS_VREDRAW mov wc.cbClsExtra, NULL mov wc.cbWndExtra, NULL push hInstance pop wc.hInstance invoke LoadCursor, NULL, IDC_ARROW mov wc.hCursor, eax mov wc.hIcon, NULL mov wc.hIconSm, NULL mov wc.hbrBackground, COLOR_WINDOW mov wc.lpszClassName, OFFSET viewclass mov wc.lpfnWndProc, OFFSET ViewWndProc mov wc.lpszMenuName, NULL invoke RegisterClassEx, ADDR wc ... invoke CreateWindowEx, WS_EX_STATICEDGE, ADDR viewclass, NULL, \ WS_POPUP Or WS_VISIBLE Or WS_VSCROLL, 0, 0, \ 442, 240, NULL, NULL, hInstance, NULL .if eax==NULL invoke GetLastError invoke wsprintf, ADDR szBuff, ADDR szFormat, eax invoke MessageBox, NULL, ADDR szBuff, ADDR szTitle, MB_OK .endif
Sloat, A couple of things, test the return value of RegisterClassEx() and if its OK, have a look at the normal window styles to see if they are responsible. Just to test, I would substitute WS_OVERLAPPEDWINDOW to see if the windows displays at all. invoke ShowWindow,hWnd,SW_SHOWNORMAL invoke UpdateWindow,hWnd Make sure you use these after it so it is displayed. GetLastError uses 0 for success so it may be giving you a false reading. Regards,
RegisterClassEx works fine, no errors. but CreateWindowEx is still not working. i forgot to include the fact that it's a child window. I tried using WS_CHILD and I tried omitting it and using SetParent, and neither worked. i'm setting the hWndParent param in the call to CreateWindowEx too, so that's not it. ::sigh::
A few things to check: Does RegisterClassEx return 0 ? If so, that's definitely an error because it's supposed to return an ATOM value for the class name. If that's not the problem, then we need to see a little bit of ViewWndProc. Especially, the code for WM_CREATE, if you are doing something with that message. Make sure you are calling DefWindowProc when you don't recognize the message number. Make sure you are either restoring or not changing the EBX, ESI, and EDI registers.
upon closer examination of ViewWndProc, i forgot to ret after i called DefWindowProc. boy, do i feel silly now. this week has just been really weird for me.