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?
Windows deals with Messageboxes internally - it simply returns the value of the button pressed.
The way you have done it is the general way to do it (using either a switch or if/else) - but windows standard defines for these buttons and you should use these instead of hard coded values.
For example, in your code the message box will either return IDYES or IDNO.
1 2 3 4 5 6 7 8 9 10 11
TEST = MessageBox(NULL, "Are you sure you want to quit?", " ", MB_ICONQUESTION | MB_YESNO);
switch(TEST)
{
case IDYES:
createbox_COPYRIGHT(); // I used this box just as a test
break;
case IDNO:
createbox_VERSION(); // same as above, for a test.
break;
}