Sign in to follow this  
CTEagle

Check for window registration

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

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