Displaying a Message in C++

C++ is a widely used general purpose programming language developed by Bell Labs and Bjarne Stroustrup. The C++ language is an extension of the original C language, and much of the original C syntax is inherited. The MessageBox function in C++ allows for a standard Windows dialog box to be displayed along with a title, body text and interactive buttons. The second argument defines the actual message text. The third argument defines the message box title. The final argument defines the interactive buttons.

Instructions

    • 1

      Type the following function into the C++ compiler:

      MessageBox(NULL, NULL1, NULL2, NULL3);

    • 2

      Replace the second argument, NULL2, with the actual text that you want to be displayed in the body of the message box. Surround the text with quotation marks.

    • 3

      Replace the third argument, NULL3, with the text that you want to be displayed in the title of the message box. Surround the title text with quotation marks.

    • 4

      Replace the fourth argument, NULL4, with the specific constant that defines the buttons you want to be displayed at the bottom of the message box. Use “MB_OK” (without the quotation marks) to display a single “OK” button. Use “MB_OKCANCEL” to display both an OK button and a CANCEL button. Use “MB_YESNOCANCEL” to allow the user to click either a “YES,” “NO” or “CANCEL” button. Use “MB_ABORTRETRYIGNORE” to display the standard “ABORT,” “RETRY” and “IGNORE” buttons.

Related Searches:

References

Resources

Comments

Related Ads

Featured