SendMessage WM_CLOSE with return

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ShadowLocke
    New Member
    • Jan 2008
    • 116

    SendMessage WM_CLOSE with return

    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.
  • ShadowLocke
    New Member
    • Jan 2008
    • 116

    #2
    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.

    Comment

    • Sick0Fant
      New Member
      • Feb 2008
      • 121

      #3
      Send the message WM_QUERYENDSESS ION. 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.

      Comment

      Working...