home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / FILEDLG6.ZIP / ERRMSG.H < prev    next >
C/C++ Source or Header  |  1990-11-14  |  9KB  |  207 lines

  1. /****************************************************************************
  2.  * ERRMSG.H -- Header file containing the data structure and function       *
  3.  *             declarations of the standard error handler function.         *
  4.  *                                                                          *
  5.  *                                                                          *
  6.  *  Modifications --                                                        *
  7.  *      09-Oct-1989 : Initial version.                                      *
  8.  *      12-Nov-1990 : Added help manager error list.                        *
  9.  ****************************************************************************/
  10.  
  11. #if !defined(_ERRMSG_INCLUDED)
  12. #define _ERRMSG_INCLUDED
  13.  
  14. #if !defined(_QC)
  15.     #pragma comment( lib,"errmsg.lib" )
  16. #endif
  17.  
  18. /****************************************************************************
  19.  * Data type definitions                                                    *
  20.  ****************************************************************************/
  21.     typedef struct {
  22.         USHORT  usCode;         // error code
  23.         USHORT  flStyle;        // message box style (see explanation below)
  24.         PSZ     pszMsg;         // ptr to error message text
  25.         } ERRORMSG;
  26.  
  27.     typedef ERRORMSG FAR * PERRORMSG;
  28.  
  29. /****************************************************************************\
  30. flStyle     Specifies the type of message-box window created. This parameter
  31.             consists of a button flag, an icon flag, a default button flag,
  32.             and any number of special flags. The following four lists
  33.             describe the available flags which can be combined using the OR
  34.             operator together for this parameter:
  35.  
  36.             Buttons              Meaning
  37.             ----------------------------------------------------------------
  38.             MB_ABORTRETRYIGNORE  Message box contains Abort, Retry, and
  39.                                  Ignore push buttons.
  40.  
  41.             MB_ENTER             Message box contains an Enter push button.
  42.  
  43.             MB_ENTERCANCEL       Message box contains Enter and Cancel push
  44.                                  buttons.
  45.  
  46.             MB_OK                Message box contains an OK push button.
  47.  
  48.             MB_OKCANCEL          Message box contains OK and Cancel push
  49.                                  buttons.
  50.  
  51.             MB_RETRYCANCEL       Message box contains Retry and Cancel push
  52.                                  buttons.
  53.  
  54.             MB_YESNO             Message box contains Yes and No push
  55.                                  buttons.
  56.  
  57.             MB_YESNOCANCEL       Message box contains Yes, No, and Cancel
  58.                                  push buttons.
  59.  
  60.             Icon                Meaning
  61.             ----------------------------------------------------------------
  62.             MB_ICONASTERISK     Message box contains asterisk icon.
  63.  
  64.             MB_ICONEXCLAMATION  Message box contains exclamation-point
  65.                                 icon.
  66.  
  67.             MB_ICONHAND         Message box contains hand icon.
  68.  
  69.             MB_ICONQUESTION     Message box contains question-mark icon.
  70.  
  71.             MB_NOICON           Message box does not contain an icon.
  72.  
  73.             Default button  Meaning
  74.             ----------------------------------------------------------------
  75.             MB_DEFBUTTON1   First button is the default (first button is
  76.                             always the default unless MB_DEFBUTTON2 or
  77.                             MB_DEFBUTTON3 is specified).
  78.  
  79.             MB_DEFBUTTON2   Second button is the default.
  80.  
  81.             MB_DEFBUTTON3   Third button is the default.
  82.  
  83.             Special flags   Meaning
  84.             ----------------------------------------------------------------
  85.             MB_APPLMODAL    Message box is application modal.
  86.  
  87.             MB_SYSTEMMODAL  Message box is system modal.
  88.  
  89.             MB_HELP         Message box contains Help push button.
  90.  
  91.             MB_MOVEABLE     Message box is movable.
  92. \****************************************************************************/
  93.  
  94.  
  95. /****************************************************************************
  96.  * Predefined error lists                                                   *
  97.  ****************************************************************************/
  98.     extern ERRORMSG SysErrMsg[];        /* system error list */
  99.     extern USHORT   SysErrCount;        /* (errors < 0x1000 && > 0x8000) */
  100.  
  101.     extern ERRORMSG PMErrMsg[];         /* PM error list */
  102.     extern USHORT   PMErrCount;         /* (errors between 0x1000 && 0x8000 */
  103.  
  104.     extern ERRORMSG HelpMgrErrors[];    /* help manager error list */
  105.     extern USHORT   HelpMgrCount;
  106. /****************************************************************************/
  107.  
  108.  
  109. /****************************************************************************/
  110. extern USHORT cdecl far _loadds _export ErrMessageBox( HWND hwndOwner,
  111.                                                        PSZ pszCaption,
  112.                                                        USHORT usErrorCode,
  113.                                                        PERRORMSG perrormsg,
  114.                                                        USHORT cErrMsgCnt,
  115.                                                        ... );
  116. /****************************************************************************\
  117. The ErrMessageBox function creates, displays, and operates a message-box
  118. window that displays the error message associated with a given error
  119. code.
  120.  
  121. Parameters  Description
  122. ----------------------------------------------------------------------------
  123. hwndOwner   Identifies the owner window of the message-box window. The owner
  124.             window is activated when ErrMessageBox returns.
  125.  
  126. pszCaption  Points to the title of the message-box window. If this parameter
  127.             is NULL, "Error" (the default title) is displayed. The maximum
  128.             length of the text is device-dependent. If the text is too long,
  129.             it will be clipped.
  130.  
  131. usErrorCode Contains the error code.
  132.  
  133. perrormsg   Points to the user defined error message list. If this
  134.             parameter is NULL then the error message list appropriate
  135.             to the error code will be used (SysErrMsg or PMErrMsg).
  136.  
  137.             The following error message lists are predefined:
  138.  
  139.                 SysErrMsg    : system error messages for error codes
  140.                                less that 0x1000 or above or equal to
  141.                                0x8000.
  142.  
  143.                 PMErrMsg     : PM error messages for error codes between
  144.                                0x1000 and 0x8000.
  145.  
  146.                 HlpMgrErrors : Help manager error messages.
  147.  
  148. cErrMsgCnt  Contains the number of items in the user defined error message
  149.             list. This parameter is ignored if perrormsg is NULL.
  150.  
  151. arguments   Optional list of arguments that are passed to the vsprintf
  152.             function in order to allow error messages to have variable
  153.             contents. NOTE THAT THIS FUNCTION REQUIRES THAT ALL POINTER
  154.             ARGUMENTS (SUCH AS POINTERS TO STRINGS) MUST BE FAR POINTERS.
  155.  
  156.  
  157. Return Value
  158.  
  159. The return value indicates the user's response to the message. It can be one
  160. of the following values:
  161.  
  162.     Value        Meaning
  163.     ------------------------------------------------------------------------
  164.     MBID_ABORT   Abort button was selected.
  165.  
  166.     MBID_CANCEL  Cancel button was selected.
  167.  
  168.     MBID_ENTER   Enter button was selected.
  169.  
  170.     MBID_IGNORE  Ignore button was selected.
  171.  
  172.     MBID_NO      No button was selected.
  173.  
  174.     MBID_OK      OK button was selected.
  175.  
  176.     MBID_RETRY   Retry button was selected.
  177.  
  178.     MBID_YES     Yes button was selected.
  179.  
  180.     MDID_ERROR   The WinMessageBox function failed--an error occurred.
  181.  
  182. If a message box has a Cancel button, MBID_CANCEL is returned if the ESCAPE
  183. key is pressed or if the Cancel button is selected. If the message box has
  184. no Cancel button, pressing the ESCAPE key has no effect.
  185.  
  186. Comments
  187.  
  188. If a message-box window is created as part of the processing of a dialog
  189. window, the dialog window should be made the owner of the message-box
  190. window.
  191.  
  192. If a system modal message-box window is created to tell the user that the
  193. system is running out of memory, the strings passed into this function
  194. should not be taken from a resource file because an attempt to load the
  195. resource file may fail due to lack of memory. Such a message-box window can
  196. safely use the hand icon (MB_ICONHAND), however, because this icon is always
  197. memory-resident.
  198.  
  199. If the message box contains a help pushbutton, the message box window
  200. identifier will be set to the error code value.
  201.  
  202. The total length of the error message string after it has been formatted
  203. and stored by vsprintf must not exceed 512 characters (including the
  204. terminating NULL character).
  205. \****************************************************************************/
  206. #endif /* _ERRMSG_INCLUDED */
  207.