CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Posts
    327

    MessageBox controls

    I created a yes/no message box in a MDI application as follows:

    void CMainFrame::OnDialogsMessage()
    { MessageBox("Message", "Title", MB_YESNO; }

    How can I output to the MDI child the messages "user clicked yes" or "user clicked no" when the user clicks either the yes or no option?

    Any response anyone can give me will be greatly appreciated.


  2. #2
    Join Date
    Apr 1999
    Posts
    3

    Re: MessageBox controls

    Take the return value of MessageBox(...) function. It returns one of the following values in your case:

    IDYES - if the user clicked 'Yes'
    IDNO - if the user clicked 'No'

    So you can write a code similar to this:

    ...
    int nSelection;
    nSelection = MessageBox("Message", "Title", MB_YESNO);

    if (nSelection == IDYES)
    {
    // action for YES
    }
    else
    {
    // action for NO
    }


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