Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Chapter 2 Variables and Identifiers Visual C++ and MFC Fundamentals


Figure 43: Creating an Elaborate Message Box........................................................................



  1. Close it and return to MSVC


2.3.7 The Message’s Return Value................................................................


After using the message box, the user must close it by clicking a button on it. Clicking
OK usually means that the user acknowledged the message. Clicking Cancel usually
means the user is changing his or her mind about the action performed previously.
Clicking Yes instead of No usually indicates that the user agrees with whatever is going
on.

In reality, the message box only displays a message and one or a few buttons. The
function used to create the message box returns a natural number that you can use as you
see fit. The return value itself is a registered constant integer and can be one of the
following:

Displayed Button(s)

If the user
clicked

The return
value is

IDOK^

IDOK^

IDCANCEL^

IDABORT^

IDRETRY

IDIGNORE

IDYES

IDNO^

IDCANCEL^

IDYES^

IDNO^

IDRETRY^

IDCANCEL^
Free download pdf