468,512 Members | 1,431 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

SendMessage WM_CLOSE with return

115 100+
Im not sure if this is possible, but i would like to send a wm_close message to a window, and if this window is for instance mspaint and it prompts "close without saving" Is there a way I can detect if the user canceled or not?

Im not tied to sendmessage so any other technique/idea i am happy to listen.
Apr 25 '08 #1
2 5041
ShadowLocke
115 100+
Dont know if this is the right way, but this worked for my particular case:

It appears after calling sendmessage it does not return to your code until after either the user response or the process terminates. So after each call to SendMessage just checking if the process is still running should suffice.
May 9 '08 #2
Sick0Fant
121 100+
Send the message WM_QUERYENDSESSION. Then, when handling it, pop-up a dialog, examine the result. If the user wants to quit, continue to WM_CLOSE, otherwise, break out of the handler.
May 9 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

11 posts views Thread by Steven | last post: by
3 posts views Thread by Rob | last post: by
3 posts views Thread by Lee Weiner | last post: by
18 posts views Thread by Lars Netzel | last post: by
4 posts views Thread by Abubakar | last post: by
2 posts views Thread by SQACSharp | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.