Archived

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

Assembler015

Events post window creation

Recommended Posts

Is there a message sent to a window after it is created and the window is fully functional so after the message is sent, the corresponding function to that message can destroy the window/edit the window if it wished. I tried using WM_SHOWWINDOW but you aren''t allowed to destroy the window through there, it crashes if you do. Thanks for any help

Share this post


Link to post
Share on other sites
When a window is to be closed, the message WM_CLOSE is sent to it. When a window is to be destroyed, the message WM_DESTROY is sent to it. The difference is often very blurry.

If you want to destroy a window, call DestroyWindow(hwnd) (but not from within the Windowproc!) To terminate a window, simply call PostQuitMessage(0). That tells Windows you want to close/destroy the window.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
okay, but what if it is a modal window/dialog, and when its created I want it to first check for some things, if those things exist I want the window to destroy itself. This doesn''t work if I do it in the constructor of the class or in showwindow, it just crashes...what other message are sent...so post window creation but pre window destruction.

Share this post


Link to post
Share on other sites