Detecting WIN32 button press.

Hey,

I have this code;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
int TEST; // only way i could assign this to the messagebox.

void createbox_QUIT()
{
	 TEST = MessageBox(NULL, "Are you sure you want to quit?", " ", MB_ICONQUESTION | MB_YESNO);
	 switch(TEST)
	 {
	     case 1:
			  createbox_COPYRIGHT(); // I used this box just as a test
		      break;
	     case 2:
			  createbox_VERSION(); // same as above, for a test.
		      break;
	 }
}


How can i detect if the person presses the yes or presses the no button?

Thanks!
Last edited on
Answered in your other question: http://www.cplusplus.com/forum/general/25953/#msg138114
Also, please don't cross-post in the future.
copy from MSDN:

Return Values
The return value is zero if there is not enough memory to create the message box.

If the function succeeds, the return value is one of the following menu-item values returned by the dialog box:

Value Meaning
IDABORT Abort button was selected.
IDCANCEL Cancel button was selected.
IDIGNORE Ignore button was selected.
IDNO No button was selected.
IDOK OK button was selected.
IDRETRY Retry button was selected.
IDYES Yes button was selected.
Topic archived. No new replies allowed.