Click to See Complete Forum and Search --> : MessageBox controls


Danielle Harvey
April 3rd, 1999, 12:42 PM
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.

Rangaraya
April 3rd, 1999, 03:39 PM
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
}