question about message boxes

Posts 16 of 6 · Page 1 of 1
question about message boxes
[php]
#include <windows.h> // include the basic windows header file

// the entry point for any Windows program
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd)
{
// create a "Hello World" message box using MessageBox()
MessageBox(NULL,
L"Hello World!",
L"Just another Hello World program!",
MB_ICONEXCLAMATION | MB_CANCELTRYCONTINUE);

return 0;
}
[/php]

How do I make stuff happen when yes, no, cancel is pushed?

I know it would have to do with the if statement but where would I use it? just getting into windows programming now. (skipped void, classes and all that stuff for now, going to get back to it tomorow)
I think you should finish C++ before going into APIs
MSDN is your god: http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx

If a message box has a Cancel button, the function returns the IDCANCEL value if either the ESC key is pressed or the Cancel button is selected. If the message box has no Cancel button, pressing ESC has no effect.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

If the function succeeds, the return value is one of the following menu-item values.
Return code/value Description

IDABORT
3



The Abort button was selected.

IDCANCEL
2



The Cancel button was selected.

IDCONTINUE
11



The Continue button was selected.

IDIGNORE
5



The Ignore button was selected.

IDNO
7



The No button was selected.

IDOK
1



The OK button was selected.

IDRETRY
4



The Retry button was selected.

IDTRYAGAIN
10



The Try Again button was selected.

IDYES
6



The Yes button was selected.
Quote Originally Posted by Kallisti View Post
I think you should finish C++ before going into APIs
And I know that... I already know how to create a simple window I was curious and went ahead and read that. But my current c++ TBQ isn't all that great. I want it to be slightly better, with a message box rather then the console. I'm going to implement all the stuff I missed into the message box game. It's just a learning process.

Quote Originally Posted by Hell_Demon View Post
MSDN is your god: MessageBox Function (Windows)

If a message box has a Cancel button, the function returns the IDCANCEL value if either the ESC key is pressed or the Cancel button is selected. If the message box has no Cancel button, pressing ESC has no effect.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

If the function succeeds, the return value is one of the following menu-item values.
Return code/value Description

IDABORT
3



The Abort button was selected.

IDCANCEL
2



The Cancel button was selected.

IDCONTINUE
11



The Continue button was selected.

IDIGNORE
5



The Ignore button was selected.

IDNO
7



The No button was selected.

IDOK
1



The OK button was selected.

IDRETRY
4



The Retry button was selected.

IDTRYAGAIN
10



The Try Again button was selected.

IDYES
6



The Yes button was selected.
Thank you very much ) that msdn website really helped as did your explanation.
Whats the "message box game"
Quote Originally Posted by Auxilium View Post
Whats the "message box game"
Just basically a game where answer yes or no to questions... the same as my console application, but in message boxes instead
Posts 16 of 6 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?