Jump to content

WinSecondaryMessageBox

From EDM2

This function creates a modal window, similar to WinMessageBox, that can be used to display error messages and ask questions.

Syntax

#define INCL_SW
#include <os2.h>

HWND        hwndParent;  /*  Parent window handle. */
HWND        hwndOwner;   /*  Owner window handle. */
PSZ         pszText;     /*  Message text. */
PSZ         pszCaption;  /*  Title of secondary message box window. */
ULONG       idWindow;    /*  ID of window. */
PSMBINFO    psmbinfo;    /*  Information block. */
ULONG       rc;          /*  Results. */

rc = WinSecondaryMessageBox(hwndParent, hwndOwner, pszText, pszCaption, idWindow, psmbinfo);

Parameters

hwndParent (HWND) - input
The parent window handle of the secondary window to be created.
hwndOwner (HWND) - input
The owner-window handle of the secondary window to be created.
pszText (PSZ) - input
The text of the message to be displayed.
pszCaption (PSZ) - input
The title of the secondary message box window.
idWindow (ULONG) - input
The identifier of the secondary message box window.
psmbinfo (PSMBINFO) - input
An information block that defines which buttons must be included in the window.

Return Value

rc (ULONG) - returns
Returns the result passed to WinDismissSecondaryWindow; this is the ID of the button that was clicked.

Remarks

Refer to WinMessageBox in the IBM OS/2 Presentation Manager Programming Reference.

Example Code

The following code illustrates creating a modal window, similar to WinMessageBox, that can be used to display error messages and ask questions.

 #define INCL_SW
 #include <os2me.h>

 SMBD Smbd[4] = {{ "~Save",    ID_SAVE,    BS_DEFAULT},
                 { "~Discard", ID_DISCARD, 0},
                 { "Cancel",   ID_CANCEL,  0},
                 { "Help",     ID_HELP,    BS_HELP}};

 SMBINFO SmbInfo;
 ULONG   Result;

 SmbInfo.hIcon = NULL;
 SmbInfo.cButtons = 4;
 SmbInfo.hwndNotify = NULL;
 SmbInfo.flStyle = MB_QUERY;
 SmbInfo.psmbd = Smbd;

 Result = WinSecondaryMessageBox (HWND_DESKTOP,
                                  HWND_DESKTOP,
                                  "Changes have not been saved.",
                                  "Title",
                                  ID_SAVEPROMPT,
                                  &SmbInfo);

Related Functions