I'm doing an assignment for class and we're suppose to write a program that pops up a window with YES/NO/CANCEL buttons and when the user pushes a button another window pops up displaying what button they clicked.
I wrote up the code and it does work, but it takes several clicks of the button for it to finally display the 2nd box. Any reason for this??
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInstance, LPSTR lpCmdLine, int nSHowCmd)
{
MessageBox(NULL, "This is my dialog box", "Dialog Box",MB_YESNOCANCEL | MB_ICONEXCLAMATION);
if (MessageBox(NULL, "This is my dialog box", "Dialog Box", MB_YESNOCANCEL | MB_ICONEXCLAMATION) == IDYES)
{
MessageBox(NULL, "User Clicked Yes", "Robert Week 1", MB_OK | MB_ICONEXCLAMATION);
}
if (MessageBox(NULL, "This is my dialog box", "Dialog Box", MB_YESNOCANCEL | MB_ICONEXCLAMATION) == IDNO)
{
MessageBox(NULL, "User Clicked No", "Robert Week 1", MB_OK | MB_ICONQUESTION);
}
}