Menu

questions about Message Boxes

2002-08-30
2012-09-26
  • Nobody/Anonymous

    I am trying to create a message box to ask the user if (s)he wants to leave the program when (s)he exits the program.  I know how to create a message box, but how to i tell if the user pressed "Yes" or "No"? I've done this in BASIC before, but never in C++. In BASIC, you declare the message box as a string and use an if statement to detirmine if the string is "yes" or "no".  Is this similar to C++, or is C++ different?

     
    • Nobody/Anonymous

      Yes there is a return value...

      you can use it like:
      if(IDYES==MessageBox(.....))
      {
      ..
      }

      and it will return 0 if it fails to create the box...

      Possible return values:
      IDABORT   
      IDCANCEL   
      IDIGNORE   
      IDNO   
      IDOK   
      IDRETRY   
      IDYES   

       
    • Nobody/Anonymous

      On a long term, just go to the Microsoft References for Windows (good old msdn site), and in that desorder there are also a lot of answers.
      By the way : did you try the style
      MB_YESNO|MB_ICONQUESTION ?

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.