Secondary Window Message Box

WinSecondaryMessageBox is analagous to WinMessageBox. Both functions create a modal message box that can be used to display error messages and ask questions.

WinSecondaryMessageBox allows more flexibility than WinMessageBox, because you can define the text that appears on the buttons, rather than choosing from a set of standard buttons with predetermined text (OK, Cancel, and so forth). WinSecondaryMessageBox uses the SMBD and SMBINFO data structures, found in the SW.H file.

The SMBD structure defines the button style, text and ID for each button included in the secondary message box:

 typedef struct _SMBD {
    CHAR   achText[MAX_SMBDTEXT + 1]; /* Text of the button, */
                                         for example, "~Cancel". */
    ULONG  idButton;                  /* Button ID returned when user
                                         chooses button. */
    LONG   flStyle;                   /* Button style ORed with
                                         internal styles. */
 } SMBD;
 typedef SMBD * PSMBD;

The SMBINFO structure defines the icon used in the message box, specifies the number of buttons in the message box, and points to the array of button definitions.

   typedef struct _SMBINFO {
      HPOINTER hIcon;         /* Icon handle                        */
      ULONG    cButtons;      /* Number of buttons                  */
      ULONG    flStyle;       /* Icon style flags (MB_ICONQUESTION) */
      HWND     hwndNotify;    /* Reserved                           */
      PSMBD    psmbd;         /* Array of button definitions        */
   } SMBINFO;
   typedef SMBINFO * PSMBINFO;


[Back: Modeless Secondary Window]
[Next: Adding Default Size to the System Menu]