Jump to content
  • Advertisement
Sign in to follow this  
CTEagle

Check for window registration

This topic is 4396 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

Once I have registered a window by using: if(!RegisterClassEx(&Host)) { MessageBox(NULL, "Window Registration Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK); } how can I go about checking ot see if it has registered?

Share this post


Link to post
Share on other sites
Advertisement
Well, if it goes the the "else" part of the if, then it has registerd (so if RegisterClassEx has returned non-zero).

You could do a GetClassInfo to retrieve, it, but it isn't neccesary.

Share this post


Link to post
Share on other sites
Quote:
Original post by CTEagle
I thought the code I provided was registering the window? Is that not correct?

It is registering the window, and checking to make sure it was registered. How else could it possibly tell you that the registration failed?

CM

Share this post


Link to post
Share on other sites
I think that I have failed to state my request clearly in my original post.

After my window has been registered, I want to be able to check to see if it has been registered from somewhere else in my code. I cannot use the same code as what I provided in my original post because the application will attempt to register the window again and of course I get a message stating that the registration failed.

Share this post


Link to post
Share on other sites
As far as I know, Windows isn't in the habit of unregistering classes without warning, so you could get away with storing the return value and checking it as your leisure:
ATOM registered_state = RegisterClassEx(&Host);

// Then at any point later

if (registered_state) {
// Window was successfully registered
} else {
// Window was not successfully registered
}
You are free to check the value of registered_state as many times as you like.

Regards
Admiral

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!