CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2001
    Location
    USA
    Posts
    298

    Catching a closing dialog window

    Is there a message that I can handle in a dialog box that gets called regardless of how the dialog is closed? I need to save changed data whether the user clicks OnOK, OnCancel, or the menu "X" button or presses the ESC key.

    Thanks

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Catching a closing dialog window

    Wm_destroy
    Victor Nijegorodov

  3. #3
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: Catching a closing dialog window

    WM_DESTROY should do it

  4. #4
    Join Date
    Jun 2001
    Location
    USA
    Posts
    298

    Re: Catching a closing dialog window

    Thanks guys.

    The VS wizard created OnDestroy for me and the comments say to put my code after the call to CDialog::OnDestroy(). Is the window still valid at that point, or should I avoid writing anything to the text controls?

  5. #5
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: Catching a closing dialog window

    Quote Originally Posted by Dave C View Post
    Thanks guys.

    The VS wizard created OnDestroy for me and the comments say to put my code after the call to CDialog::OnDestroy(). Is the window still valid at that point, or should I avoid writing anything to the text controls?
    Wouldn't it be faster to write the code and check than to post here and wait for a response?

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Catching a closing dialog window

    Quote Originally Posted by Dave C View Post
    Thanks guys.

    The VS wizard created OnDestroy for me and the comments say to put my code after the call to CDialog::OnDestroy(). Is the window still valid at that point, or should I avoid writing anything to the text controls?
    Don't you know how to debug?
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured