Jump to content
  • Advertisement
Sign in to follow this  

[Win32 C++] Close Button [SOLVED]

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

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)

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!