home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1995 November / PCWK1195.iso / inne / podstawy / os2 / nakladki / pc2v190.exe / SOURCE.ZIP / Source / Error.h < prev    next >
Encoding:
Text File  |  1995-05-01  |  6.3 KB  |  94 lines

  1. /***********************************************************************\
  2.  *                               Error.h                               *
  3.  *        Copyright (C) by Stangl Roman, 1992, 1993, 1994, 1995        *
  4.  * This Code may be freely distributed, provided the Copyright isn't   *
  5.  * removed.                                                            *
  6.  *                                                                     *
  7.  * Requires: Error.c    The routing General_Error                      *
  8.  *           Error.h    The include-file that defines the macros       *
  9.  *                      GEN_ERR, DOS_ERR, USR_ERR                      *
  10.  *                                                                     *
  11.  * Error is a general errorhandler for OS/2 2.0 PM programmer to easy  *
  12.  * program development. The routine PM_Error displays:                 *
  13.  *      ErrMsg          The message that hints the error reason        *
  14.  *      ErrModule       The module containing the error                *
  15.  *      ErrLine         The sourcecode line, that contains the error   *
  16.  *      Error           The error returned by an OS/2 API              *
  17.  * The routine requires the following parameters passed:               *
  18.  *      HAB hab         The anchor block handle                        *
  19.  *      HWND hwndOwner  The owner windowhandle of the message box      *
  20.  *      ULONG ulWindow  The message box window ID, which is the ID of  *
  21.  *                      an entry in the online help                    *
  22.  *      ULONG ulStyle   The message box style                          *
  23.  *      UCHAR *pucMsg   An optional message that describes where the   *
  24.  *                      error occured                                  *
  25.  *      PSZ ErrModule   The pointer to the name of the module _FILE_   *
  26.  *      LONG ErrLine    The pointer to the sourcecodeline __LINE__     *
  27.  *                                                                     *
  28.  * This routine displays a message box, with the style specified in    *
  29.  * ulStyle. The message box automatically returns the pushbutton       *
  30.  * selected by the user. OS/2 APIs get called to determine the reason  *
  31.  * of the OS/2 (probably) internal error.                              *
  32.  *                                                                     *
  33.  * The routine Dos_Error displays:                                     *
  34.  *      ErrMsg          The message that hints the error reason        *
  35.  *      ErrModule       The module containing the error                *
  36.  *      ErrLine         The sourcecode line, that contains the error   *
  37.  *      Error           The error returned by an OS/2 API              *
  38.  * The routine requires the following parameters passed:               *
  39.  *      ULONG ulRc      The returncode of an OS/2 API                  *
  40.  *      HWND hwndOwner  The owner windowhandle of the message box      *
  41.  *      ULONG ulWindow  The message box window ID, which is the ID of  *
  42.  *                      an entry in the online help                    *
  43.  *      ULONG ulStyle   The message box style                          *
  44.  *      UCHAR *pucMsg   An optional message that describes where the   *
  45.  *                      error occured                                  *
  46.  *      PSZ ErrModule   The pointer to the name of the module _FILE_   *
  47.  *      LONG ErrLine    The pointer to the sourcecodeline __LINE__     *
  48.  *                                                                     *
  49.  * This routine displays a message box, with the style specified in    *
  50.  * ulStyle. The message box automatically returns the pushbutton       *
  51.  * selected by the user. The return code of an OS/2 API is displayed.  *
  52.  *                                                                     *
  53.  * The routine User_Error displays:                                    *
  54.  *      ErrMsg          The message that hints the error reason        *
  55.  *      ErrModule       The module containing the error                *
  56.  *      ErrLine         The sourcecode line, that contains the error   *
  57.  *      Error           The error indicated by the user                *
  58.  * The routine requires the following parameters passed:               *
  59.  *      HWND hwndOwner  The owner windowhandle of the message box      *
  60.  *      ULONG ulWindow  The message box window ID, which is the ID of  *
  61.  *                      an entry in the online help                    *
  62.  *      ULONG ulStyle   The message box style                          *
  63.  *      UCHAR *pucMsg   An optional message that describes where the   *
  64.  *                      error occured                                  *
  65.  *      PSZ ErrModule   The pointer to the name of the module _FILE_   *
  66.  *      LONG ErrLine    The pointer to the sourcecodeline __LINE__     *
  67.  *                                                                     *
  68.  * This routine displays a message box, with the style specified in    *
  69.  * ulStyle. The message box automatically returns the pushbutton       *
  70.  * selected by the user. This function is most useful for user inter-  *
  71.  * action, because no anchor block, but a message, is specified.       *
  72.  *                                                                     *
  73. \***********************************************************************/
  74.  
  75. #define         INCL_WIN
  76. #define         INCL_DOSMISC
  77.  
  78. #include        <os2.h>
  79. #include        <stdio.h>
  80. #include        <stdlib.h>
  81. #include        <string.h>
  82.  
  83. #define         PM_ERR(hab, hwndOwner, ulWindow, ulStyle, pucMsg) \
  84.                     PM_Error(hab, hwndOwner, ulWindow, ulStyle, pucMsg, _FILE_, __LINE__)
  85. #define         DOS_ERR(rc, hwndOwner, ulWindow, ulStyle, pucMsg) \
  86.                     Dos_Error(rc, hwndOwner, ulWindow, ulStyle, pucMsg, _FILE_, __LINE__)
  87. #define         USR_ERR(hwndOwner, ulWindow, ulStyle, pucMsg) \
  88.                     User_Error(hwndOwner, ulWindow, ulStyle, pucMsg, _FILE_, __LINE__)
  89.  
  90. extern ULONG PM_Error(HAB hab, HWND hwndOwner, ULONG ulWindow, ULONG ulStyle, UCHAR *pucMsg, PSZ ErrModule, LONG ErrLine);
  91. extern ULONG Dos_Error(ULONG ulRc, HWND hwndOwner, ULONG ulWindow, ULONG ulStyle, UCHAR *pucMsg, PSZ ErrModule, LONG ErrLine);
  92. extern ULONG User_Error(HWND hwndOwner, ULONG ulWindow, ULONG ulStyle, UCHAR *pucMsg, PSZ ErrModule, LONG ErrLine);
  93.  
  94.