Skip to main content
GameDev.net gamedev.net
🔒 Locked

CreateWindowEx!!!!!!!!

Started by Yohomyth Sep 7, 2005 at 10:35 PM 2 replies 1.1k views
Original Post
Yohomyth
Yohomyth
First-chance exception in test.exe (MYGL.DLL): 0xC0000005: Access Violation. ^^ CreateWindowEx keeps making this pop up when I debug, and when I run the application it just crashes. I've checked every parameter and all should be working, ( dwExstyle = WS_EX_APPWINDOW, dwstyle = WS_POPUP ), and my WndProc is fine, and theres nothing wrong with my WNDCLASS, so why could it be doing this? Thx in advance
------------------------------------------------------------"Many combilations elizagerth. I hope you see my particles." - Senor Cardgage
Palidine
Palidine
run your app in the debugger. wait for it to crash. take a look at the variables on the stack and try and figure out what's wrong. If nothing is obviously incorrect, throw in some breakpoints in and about your logic leading up to the crash point. verify that everything is as it should be.

if you want more useful help post your code surrounding the line that crashes.

-me
Aprosenf
Aprosenf
I'm going to *guess* that you're trying to use a class method as your window procedure. You can't do this because there is a hidden 'this' pointer that should get passed to it, but Windows has no idea what ths 'this' pointer should be, and as a result the program crashes when you enter the function. In order to fix this, you need to store the 'this' pointer in the window (using SetWindowLong()), and then use a static class method as the actual windows procedure that you pass in the WNDCLASS struct, which delegates the message to the class method by grabbing the this pointer using GetWindowLong().
timw
timw
did you register your class before calling the funciton?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.