Sign in to follow this  
Yohomyth

CreateWindowEx!!!!!!!!

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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().

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this