Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

dreddlox

[Solved]Win32 GDI problem, couldn't solve after 3 code rewrites

This topic is 5205 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have copied code from a working project(in MSVC.net), only to find it refuses to work. I've tried 3 complete rewrites of window creation code, as well as copying working code however it still will not work. As I have tried many many combinations of parameters for RegisterClass, RegisterClassEx and CreateWindow, im sure its nothing to do with the actual code. _basically_ heres what i've got make, clear & fill WNDCLASS/WNDCLASSEX struct pass it to RegisterClass, which returns a number ~40000, presumably an ATOM call GetLastError, returns code 2, "file not found" call CreateWindow with class, returns NULL call GetLastError, returns code 0, afaik, no error Im not using a console application, not multithreading and have no compiler errors. Does anyone have any experience with this and do they know how to solve it? [edited by - Dreddlox on April 15, 2004 9:11:01 PM]

Share this post


Link to post
Share on other sites
Advertisement
Just to start off being nitpicky - RegisterClass and CreateWindow are in USER not in GDI.

But anyway... RegisterClass didn''t fail (it didn''t return 0), therefore you should not call GetLastError. Windows usually doesn''t do anything with the last error if things work. If there''s no error the last error is basically undefined.

In my experience the usual reason for CreateWindow failing is because you did something wrong in your WindowProc. Put a break point on the call to CreateWindow, on the next line, and another at the start of your WindowProc. Now you can debug every message you get from the beginning of the window creation process until CreateWindow returns. In particular the last message you get is probably being handled wrong somehow.

Share this post


Link to post
Share on other sites
Thank you!
it was a problem with my WndProc, the one thing I wasn''t rewriting :-S
You''ve saved me from scrapping & redoing the whole thing, thanks for helping

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!