According to the documentation , MessageBox
returns a int
that can have the following values:
- IDABORT: The abort button has been pressed
- IDCANCEL: The cancel button or the ESC key has been pressed
- IDCONTINUE: The continue button has been pressed
- IDIGNORE: The ignore button has been pressed
- IDNO: The no button has been pressed
- IDOK: The ok button has been pressed
- IDRETRY: The Retry button has been pressed
- IDTRYAGAIN: The button has been pressed to try again
- IDYES: The yes button has been pressed
In any case, the call is blocking, that is, the thread does not leave the function until the modal window has been closed, so to execute something when the window closes it is enough to put the code just after the call to the function:
MessageBox(0,"Title","description",1);
std::cerr << "Se acaba de cerrar la ventana modal";
If, on the other hand, you want to act according to the button pressed by the user:
int res = MessageBox(0,"Title","description",1);
switch( res )
{
case IDCANCEL:
/* ... El usuario presiona cancelar o ESC ... */
break;
case IDOK:
/* ... El usuario presiona el boton OK ... */
break;
}