| | |
getting decission from message box?
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2007
Posts: 15
Reputation:
Solved Threads: 0
hi guys, new to c++ here. So we have a school project due tomorrow, a hangman game of sort and i just wanted to go a bit above the required so i thought i would put in a message box. Now i got the working and all but the thing is, i would like to figure out that if the user clicks NO then the program exits? how can i do this?
as you can see, my msg box has 3 click able buttons, YES NO and CANCLE. How can i make my program do something is say NO is pressed?
like
if NO is pressed
exit
thank you!
C++ Syntax (Toggle Plain Text)
LPCTSTR Cap = L"HOW TO PLAY HANGMAN"; MessageBox(NULL, L"sample",Cap, MB_YESNOCANCEL );
as you can see, my msg box has 3 click able buttons, YES NO and CANCLE. How can i make my program do something is say NO is pressed?
like
if NO is pressed
exit
thank you!
•
•
Join Date: Dec 2007
Posts: 360
Reputation:
Solved Threads: 69
It's the same as for AfxMessageBox: http://msdn.microsoft.com/en-us/libr...cb(VS.71).aspx
If you are forced to reinvent the wheel at least try to invent a better one!
Please use code tags - Please mark solved threads as solved
Please use code tags - Please mark solved threads as solved
C++ Syntax (Toggle Plain Text)
int DisplayMessageBox() { int msgboxID = MessageBox( NULL, (LPCWSTR)L"Sample", Cap, MB_YESNOCANCEL ); switch (msgboxID) { case IDCANCEL: // TODO: add code break; case IDYES: // TODO: add code break; case IDNO: // TODO: add code break; } return msgboxID; }
Last edited by Narue; May 14th, 2009 at 3:54 pm. Reason: added code tags
I know I am. Therefore I am.
![]() |
Similar Threads
- how to print out an array in a message box (Java)
- Message Box Switch Statement (Java)
- I need the Mac OS X message box function (C)
- message box (ASP.NET)
- Time Release Message Box (C)
- download message box's events (ASP)
- repeating the whole program after pressing Yes button in the confirmation message box (Java)
Other Threads in the C++ Forum
- Previous Thread: changing fonts?
- Next Thread: Can a method have have internal linkage?
| Thread Tools | Search this Thread |
api array arrays beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion convert count data database delete desktop developer directshow dll dynamiccharacterarray email encryption error file forms fstream function functions game generator getline google graph homeworkhelper iamthwee ifstream input int integer java lib linkedlist linux list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets





