home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / os2 / filedlg5 / errmsg / errmsg.txt < prev    next >
Encoding:
Text File  |  1989-11-26  |  7.5 KB  |  197 lines

  1. .context List Categories
  2. .list
  3. Standard error handler
  4. .context Standard error handler
  5. .list
  6. ErrMessageBox   Standard PM error message function.
  7. ERRORMSG        Record structure used in a user defined error message list.
  8. .context ERRORMSG
  9. .context PERRORMSG
  10. .ref ErrMessageBox
  11. #define INCL_WINDIALOGS
  12. #include <os2.h>
  13. #include <errmsg.h>
  14.  
  15. typedef struct {
  16.     USHORT  usCode;         // error code
  17.     USHORT  flStyle;        // message box style (see explanation below)
  18.     PSZ     pszMsg;         // ptr to error message text
  19.     } ERRORMSG;
  20.  
  21. typedef ERRORMSG FAR * PERRORMSG;
  22.  
  23. The \bERRORMSG\p structure defines the record structure used in a user defined
  24. error message list used by the \bErrMessageBox\p function.
  25.  
  26. \bParameters  Description\p
  27. ────────────────────────────────────────────────────────────────────────────
  28. \busCode\p      Error code.
  29.  
  30. \bflStyle\p     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.             \bButtons              Meaning\p
  37.             ────────────────────────────────────────────────────────────────
  38.             \iMB_ABORTRETRYIGNORE\p  Message box contains Abort, Retry, and
  39.                                  Ignore push buttons.
  40.  
  41.             \iMB_ENTER\p             Message box contains an Enter push button.
  42.  
  43.             \iMB_ENTERCANCEL\p       Message box contains Enter and Cancel push
  44.                                  buttons.
  45.  
  46.             \iMB_OK\p                Message box contains an OK push button.
  47.  
  48.             \iMB_OKCANCEL\p          Message box contains OK and Cancel push
  49.                                  buttons.
  50.  
  51.             \iMB_RETRYCANCEL\p       Message box contains Retry and Cancel push
  52.                                  buttons.
  53.  
  54.             \iMB_YESNO\p             Message box contains Yes and No push
  55.                                  buttons.
  56.  
  57.             \iMB_YESNOCANCEL\p       Message box contains Yes, No, and Cancel
  58.                                  push buttons.
  59.  
  60.             \bIcon                Meaning\p
  61.             ────────────────────────────────────────────────────────────────
  62.             \iMB_ICONASTERISK\p     Message box contains asterisk icon.
  63.  
  64.             \iMB_ICONEXCLAMATION\p  Message box contains exclamation-point
  65.                                 icon.
  66.  
  67.             \iMB_ICONHAND\p         Message box contains hand icon.
  68.  
  69.             \iMB_ICONQUESTION\p     Message box contains question-mark icon.
  70.  
  71.             \iMB_NOICON\p           Message box does not contain an icon.
  72.  
  73.             \bDefault button  Meaning\p
  74.             ────────────────────────────────────────────────────────────────
  75.             \iMB_DEFBUTTON1\p   First button is the default (first button is
  76.                             always the default unless MB_DEFBUTTON2 or
  77.                             MB_DEFBUTTON3 is specified).
  78.  
  79.             \iMB_DEFBUTTON2\p   Second button is the default.
  80.  
  81.             \iMB_DEFBUTTON3\p   Third button is the default.
  82.  
  83.             \bSpecial flags   Meaning\p
  84.             ────────────────────────────────────────────────────────────────
  85.             \iMB_APPLMODAL\p    Message box is application modal.
  86.  
  87.             \iMB_SYSTEMMODAL\p  Message box is system modal.
  88.  
  89.             \iMB_HELP\p         Message box contains Help push button.
  90.  
  91.             \iMB_MOVEABLE\p     Message box is movable.
  92.  
  93. \bpszMsg\p      Points to the error message text.
  94.  
  95.  
  96. \bSee Also\p
  97.  
  98.     \bErrMessageBox\p
  99. .context ErrMessageBox
  100. .ref ERRORMSG,PERRORMSG,WinMessageBox,WinFlashWindow,WM_HELP
  101. #define INCL_WINDIALOGS
  102. #include <os2.h>
  103. #include <errmsg.h>
  104.  
  105. .paste Syntax
  106. USHORT \bErrMessageBox\p( \ihwndOwner\p,\ipszCaption\p,\iusErrorCode\p,
  107.                       \iperrormsg\p,\icErrMsgCnt\p,[argument]... )
  108. HWND \ihwndOwner\p;         /* owner window handle                          */
  109. PSZ \ipszCaption\p;         /* message box window title                     */
  110. USHORT \iusErrorCode\p;     /* error code                                   */
  111. PERRORMSG \iperrormsg\p;    /* pointer to user defined error list           */
  112. USHORT \icErrMsgCnt\p;      /* number of items in user defined error list   */
  113. .end
  114.  
  115. The \bErrMessageBox\p function creates, displays, and operates a message-box
  116. window that displays the error message associated with a given error
  117. code.
  118.  
  119. \bParameters  Description\p
  120. ────────────────────────────────────────────────────────────────────────────
  121. \ihwndOwner\p   Identifies the owner window of the message-box window. The owner
  122.             window is activated when ErrMessageBox returns.
  123.  
  124. \ipszCaption\p  Points to the title of the message-box window. If this parameter
  125.             is NULL, "Error" (the default title) is displayed. The maximum
  126.             length of the text is device-dependent. If the text is too long,
  127.             it will be clipped.
  128.  
  129. \iusErrorCode\p Contains the error code.
  130.  
  131. \iperrormsg\p   Points to the user defined error message list. If this
  132.             parameter is NULL then the default system error message
  133.             list will be used.
  134.  
  135. \icErrMsgCnt\p  Contains the number of items in the user defined error message
  136.             list. This parameter is ignored if perrormsg is NULL.
  137.  
  138. \iargument\p    Optional list of arguments that are passed to the
  139.             vsprintf function in order to allow error messages to have
  140.             variable contents. NOTE THAT THIS FUNCTION REQUIRES THAT ALL
  141.             POINTER ARGUMENTS (SUCH AS POINTERS TO STRINGS) MUST BE FAR
  142.             POINTERS.
  143.  
  144. \bReturn Value\p
  145.  
  146. The return value indicates the user's response to the message. It can be one
  147. of the following vlaues:
  148.  
  149.     \bValue        Meaning\p
  150.     ────────────────────────────────────────────────────────────────────────
  151.     \iMBID_ABORT\p   Abort button was selected.
  152.  
  153.     \iMBID_CANCEL\p  Cancel button was selected.
  154.  
  155.     \iMBID_ENTER\p   Enter button was selected.
  156.  
  157.     \iMBID_IGNORE\p  Ignore button was selected.
  158.  
  159.     \iMBID_NO\p      No button was selected.
  160.  
  161.     \iMBID_OK\p      OK button was selected.
  162.  
  163.     \iMBID_RETRY\p   Retry button was selected.
  164.  
  165.     \iMBID_YES\p     Yes button was selected.
  166.  
  167.     \iMDID_ERROR\p   The WinMessageBox function failed--an error occurred.
  168.  
  169. If a message box has a Cancel button, MBID_CANCEL is returned if the ESCAPE
  170. key is pressed or if the Cancel button is selected. If the message box has
  171. no Cancel button, pressing the ESCAPE key has no effect.
  172.  
  173. \bComments\p
  174.  
  175. If a message-box window is created as part of the processing of a dialog
  176. window, the dialog window should be made the owner of the message-box
  177. window.
  178.  
  179. If a system modal message-box window is created to tell the user that the
  180. system is running out of memory, the strings passed into this function
  181. should not be taken from a resource file because an attempt to load the
  182. resource file may fail due to lack of memory. Such a message-box window can
  183. safely use the hand icon (MB_ICONHAND), however, because this icon is always
  184. memory-resident.
  185.  
  186. If the message box contains a help pushbutton, the message box window
  187. identifier will be set to the error code value.
  188.  
  189. The total length of the error message string after it has been formatted
  190. and stored by vsprintf must not exceed 512 characters (including the
  191. terminating NULL character).
  192.  
  193.  
  194. See Also
  195.  
  196.     \bERRORMSG\p, \bWinMessageBox\p, \bWinFlashWindow\p, \bWM_HELP\p
  197.