Device Manage for OS/2

DevCon for OS/2 - Developer Connection

Operating systems:
ArcaOS, eComStation, IBM OS/2 Warp
eComStation myths 

(Unsorted)  
 
 
Compilers  
 
 
Tools  
 
 
REXX  
 
 
Drivers/kernel  
 
 

 

 

/ Guidelines: Additional control elements / Message box / Message box Usage

Usage of Message box

To use extended message box instead of standard OS/2 PM, use ExMessageBox() functions instead of WinMessageBox() in your application. The parameter list of ExMessageBox() is compatible with WinMessageBox(). All additional parameters are optional:

ULONG APIENTRY ExMessageBox(HWND    hwndParent,    // Parent window
          HWND    hwndOwner,     // Owner window
          PSZ     pszText,       // Message-box window message
          PSZ     pszCaption,    // Message-box title
          ULONG   idWindow,      // Message-box window identity
          ULONG   flStyle,       // Message-box window style
          [PSZ     pszComment,    // Comment text. Significant only if MB_COMMENT flag is specified
          [PSZ     pszButton1,    // Button 1 text. Significant only if MB_OWNCAPTIONS flag is specified
          [PSZ     pszButton2,    // Button 2 text. Significant only if MB_OWNCAPTIONS flag is specified
          [PSZ     pszButton3,    // Button 3 text. Significant only if MB_OWNCAPTIONS flag is specified
          [PSZ     pszButtonHelp, // "Help" button text. Significant only if MB_OWNCAPTIONS flag is specified
          [LANGE   hLange,        // LANGE handle, used to translate button text. Significant only if MB_OWNLANGE flag is specified
          [HMODULE hmodResource,  // Handle of resource DLL. Significant only if MB_OWNICON flag is specified
          [ULONG   ulID]]]]]]]]); // ID of the icon in the resource DLL. Significant only if MB_OWNICON flag is specified

As you can see, the parameter order is significant, so if, for example, pszButton* parameters are not used (MB_OOWNCAPTIONS flag is not specified), but hLange parameter is used (MB_OWNLANGE flag is specified), you cannot just ommit those parameters. Use NULL instead.

Be careful: you MUST specify a parameter if, an appropriate flag is set. If, for example, MB_OWNCAPTIONS flag is set, then:

  • If MB_OK flag is set, the message box contains only one button, so you have to specify only pszButton1 parameter.
  • If MB_YESNO flag is set, the message box contains two buttons, so you have to specify both pszButton1 and pszButton2 parameters.
  • If MB_ABORTRETRYIGNORE flag is set, the message box contains three buttons, so you have to specify pszButton1, pszButton2 and pszButton3 parameters.
  • IF MB_HELP flag is set, the message box contains "Help" button, so you have to specify pszButtonHelp parameter.

Here is the full list of new styles (must be OR'ed in flStyle parameter):

MB_BIGICON      // Use big icons. Otherwise, small icons are used. 
                   Big icons are 64x64 for LoRes (96dpi) screens and 
                   80x80 for HiRes (120dpi) screens. Ignored if MB_OWNICON 
                   flag is set.
                   
MB_ANIMATED     // Use animated icons.

MB_COMMENT      // MessageBoxt contains not only caption, but also comment, 
                   specified by pszComment parameter. Usually caption text 
                   is bold, and comment text is not.
                   
MB_MINBUTTON    // MessageBox contains "minimize" button.

MB_OWNLANGE     // Use your own NLS (specified by hLange parameter) to 
                   translate all the text in the MessageBox. Otherwise, 
                   PROGRESS.NLS is used.
                   
MB_OWNCAPTIONS  // Use own captions on the message box buttons (see above).

MB_OWNICON      // Use your own icon (icon set) instead of internal one (see 
                   below).
                   
MB_NODEFBUTTON	 // None of the buttons in the message box is marked as 
                   default. "ENTER" key will not press any buttons (unless 
                   you have selected one of them with arrow kwys, for example).
                   

Using your own icons:

When MB_OWNICON flag is set, both hmodResource and ulID parameters must be specified. If MB_ANIMATED flag is not set, PNG image stored in hmodResource with resource type = RT_PNG (defined in PROGRESS.H) and ID = ulID is loaded and used as an icon. If MB_ANIMATED flag is set, a set of PNG images stored in hmodResource with resource type = RT_PNG and IDs starting from ulID untill first ID which is not existed used as an icon.

  • If hmodResource = 0, resources are loaded from the executable of the application.
  • If hmodResource = -1, resources are loaded from PROGRESS.DLL.

Otherwise hmodResource is the handle of the DLL, obtained by DosLoadModule() function.

The list of resource IDs of the icons stored in the PROGRESS.DLL (defined in PROGRESS.H):

ID_PROGRESS_PNG_ICON_PERCENT  - A set of 21 images, used to display icon with percentage. Minimum 2 images, maximum 101 image.
D_PROGRESS_PNG_ICON          - A set of 12 images, used to display animated icon looop.

IDP_ICON_ERROR_32             - A set of 14 images: "Error"	- "X" icon 32x32
IDP_ICON_ERROR_40             - A set of 14 images: "Error"	- "X" icon 40x40
IDP_ICON_ERROR_64             - A set of 14 images: "Error"	- "X" icon 64x64
IDP_ICON_ERROR_80             - A set of 14 images: "Error"	- "X" icon 80x80

IDP_ICON_INFO_32              - A set of 14 images: "Information" - "i" icon 32x32
IDP_ICON_INFO_40              - A set of 14 images: "Information" - "i" icon 40x40
IDP_ICON_INFO_64              - A set of 14 images: "Information" - "i" icon 64x64
IDP_ICON_INFO_80              - A set of 14 images: "Information" - "i" icon 80x80

IDP_ICON_QUERY_32             - A set of 14 images: "Query" - "?" icon 32x32
IDP_ICON_QUERY_40             - A set of 14 images: "Query" - "?" icon 40x40
IDP_ICON_QUERY_64             - A set of 14 images: "Query" - "?" icon 64x64
IDP_ICON_QUERY_80             - A set of 14 images: "Query" - "?" icon 80x80

IDP_ICON_WARNING_32           - A set of 14 images: "Warning" - "!" icon 32x32
IDP_ICON_WARNING_40           - A set of 14 images: "Warning" - "!" icon 40x40
IDP_ICON_WARNING_64           - A set of 14 images: "Warning" - "!" icon 64x64
IDP_ICON_WARNING_80           - A set of 14 images: "Warning" - "!" icon 80x80

 


 

(C) OS2.GURU 2001-2024