Ignore:
Timestamp:
Sep 13, 1999, 4:57:08 PM (26 years ago)
Author:
phaller
Message:

Fix: error box for WinImage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/misc.cpp

    r705 r922  
    1 /* $Id: misc.cpp,v 1.10 1999-08-26 12:55:36 sandervl Exp $ */
     1/* $Id: misc.cpp,v 1.11 1999-09-13 14:57:07 phaller Exp $ */
    22
    33/*
     
    346346//******************************************************************************
    347347//******************************************************************************
     348
     349
     350/*****************************************************************************
     351 * Name      : DebugErrorBox
     352 * Purpose   : display an apprioriate error box with detailed information
     353 *             about the error cause
     354 * Parameters: APIRET iErrorCode - OS/2 error code
     355 *             PSZ    pszFormat  - printf-format string
     356 *             ...
     357 * Variables :
     358 * Result    : return code of the message box
     359 * Remark    :
     360 * Status    :
     361 *
     362 * Author    : Patrick Haller [Tue, 1999/09/13 19:55]
     363 *****************************************************************************/
     364
     365int SYSTEM EXPORT DebugErrorBox(ULONG  iErrorCode,
     366                                char*  pszFormat,
     367                                ...)
     368{
     369  char   szMessageBuffer[1024];              /* buffer for the text message */
     370  char   szErrorBuffer[1024];       /* buffer for the operating system text */
     371  ULONG  bc;                                                       /* dummy */
     372  APIRET rc2;                                             /* API returncode */
     373  int    iRC;                                    /* message box return code */
     374
     375  USHORT  sel = RestoreOS2FS();
     376  va_list argptr;
     377
     378  // clear memory
     379  memset (szMessageBuffer, 0, sizeof(szMessageBuffer));
     380  memset (szErrorBuffer, 0, sizeof(szErrorBuffer));
     381
     382  // build message string
     383  va_start(argptr, pszFormat);
     384  vsprintf(szMessageBuffer, pszFormat, argptr);
     385  va_end(argptr);
     386
     387  // query error string
     388  rc2 = DosGetMessage(NULL,
     389                      0,
     390                      szErrorBuffer,
     391                      sizeof(szErrorBuffer),
     392                      iErrorCode,
     393                      "OSO001.MSG",
     394                      &bc);
     395
     396  // display message box
     397  iRC = WinMessageBox(HWND_DESKTOP,
     398                      NULLHANDLE,
     399                      szMessageBuffer,
     400                      szErrorBuffer,
     401                      0,
     402                      MB_OK | MB_ICONEXCLAMATION | MB_MOVEABLE);
     403  SetFS(sel);
     404  return iRC;
     405}
Note: See TracChangeset for help on using the changeset viewer.