Jump to content
  • Advertisement
Sign in to follow this  
hkBattousai

[Win32 C++] Close Button [SOLVED]

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

Advertisement
Thank you for CS_NOCLOSE idea.

One another way is manipulating WM_CLOSE Windows message.
When user clicks close button WM_CLOSE is sent to queue. DefWindowProc() gets WM_CLOSE and sends WM_DESTROY. In most program code, the program getting WM_DESTROY calls PostQuitMessage() API function. This function causes WM_QUIT to be sent into message queue. GetMessage() function geting WM_QUIT returns zero and exits the loop below :

//const DWORD WM_QUIT 0;
while (GetMessage(&Msg, NULL, 0, 0) > 0)
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}


But if you prevent DefWindowProc() getting WM_CLOSE, non of the above happens. You can add your own code and hide the window.

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!