MessageBox
A MessageBox pops up to warn or notify the user of some condition. In many cases, this will be an error message, but can also be confirmation or informational message. The message box displays the same as a dialog box, as a white box with a black border and gray shadow. The title is also displayed the same way that it is with a dialog box, in a separate region above the client portion of the window. The title is also drawn in reverse video when the message box receives the focus. Inside the client portion of the message box are multiple text messages.
Window Structure Details
- int x,y,w,h: These parameters give the display position and area of the message box.
- PLHRES Title: Title defines the title of the MessageBox (displayed in a separate, rectangular region above the message box contents).
- PLHDATA Data: Data is a "near" pointer to an array of indirect pointers (array of "near" pointers to "far" pointers) to the text strings that will be displayed inside the message box. MessageBox displays each text string starting at the next line, and requires that each text string be null-terminated. MessageBox displays the text following a <CR><LF> sequence in any of the strings, starting at the next line in the message box. That is, a two line message may be created by having an array of two pointers (each that points to a single line) or one pointer to a string with an embedded CR/LF.
- UINT LogicalSize: LogicalSize gives the number of individual, null-terminated text strings to be displayed inside the message box. LogicalSize should not reflect the number of lines displayed, only the number of pointers that Data is pointing to.
- UINT Style: In addition to the global styles, MSG_NOSHADOW causes the window border to be drawn without a shadow around the bottom and right edges. MSG_CENTER_LINES causes each of the text strings to be horizontally centered within the width of the message box.
- PLHWINDOW Parent: Used by the Object class handler.t
- PLHFKEYS FKeys: Used by the Object class handler.
- PLHMENU Menu: Used by the Object class handler.
- UINT Selection: Not used.
- UINT WindowTop: Not used.
Messages
- KEYSTROKE: The following keys are recognized:
Esc, and Enter destroy the message box.
- DRAW: MessageBox draws the message box with any border and shadow and/or title.
- APPEAR: If STYLE_WHCHAR is being used, the MessageBox handler converts the specified size of the window in terms of text characters to the corresponding display units size, including any window border and shadow. MessageBox saves the resulting value in the w and h fields.
- DISAPPEAR: If STYLE_WHCHAR is being used, MessageBox converts the calculated size of the window in terms of display units (w,h) back to the original size of the window in terms of text characters.
- SETFOCUS: MessageBox passes the message on to Object and then causes the window title to be drawn in reverse video by issuing a DRAW, DRAW_TITLE message.
- CREATE: Passed to the Object class handler.
- LOSEFOCUS: Passed to the Object class handler.
- NULLEVENT: Passed to the Object class handler.
- DESTROY: Passed to the Object class handler.
- TERMINATE: Passed to the Object class handler.
- ACTIVATE: Passed to the Object class handler.
- DEACTIVATE: Passed to the Object class handler.
- NOTIFY: Passed to the Object class handler.
- COMMAND: Passed to the Object class handler.