Exemplo n.º 1
0
/**************************************************************************
 *
 *  Name       : AbortXLogo
 *
 *  Description: Report an error returned from an API service
 *
 *  Concepts   :  use of message box to display information
 *
 *  API's      :  DosBeep
 *                WinGetErrorInfo
 *                WinMessageBox
 *                WinFreeErrorInfo
 *                WinPostMsg
 *
 *  Parameters :  hwndFrame = frame window handle
 *                hwndClient = client window handle
 *
 *  Return     :  [none]
 *
 *************************************************************************/
VOID AbortXLogo(HWND hwndFrame, HWND hwndClient)
{
   PERRINFO  pErrInfoBlk;
   PSZ       pszOffSet;
   void      stdprint(void);

   DosBeep(100,10);
   if ((pErrInfoBlk = WinGetErrorInfo(hab)) != (PERRINFO)NULL)
   {
      pszOffSet = ((PSZ)pErrInfoBlk) + pErrInfoBlk->offaoffszMsg;
      pszErrMsg = ((PSZ)pErrInfoBlk) + *((PSHORT)pszOffSet);

      if ((INT)hwndFrame && (INT)hwndClient)
        WinMessageBox(HWND_DESKTOP,          /* Parent window is desktop  */
                      hwndFrame,             /* Owner window is our frame */
                      (PSZ)pszErrMsg,        /* PMWIN Error message       */
                      "XLogo Error Message", /* Title bar message         */
                      MSGBOXID,              /* Message identifier        */
                      MB_MOVEABLE | MB_CUACRITICAL | MB_CANCEL ); 
                                             /* Flags                     */

      WinFreeErrorInfo(pErrInfoBlk);
   }
   WinPostMsg(hwndClient, WM_QUIT, (MPARAM)NULL, (MPARAM)NULL);
} /* End of AbortXLogo */
Exemplo n.º 2
0
VOID ReportError(HAB hab)
{
    PERRINFO  perriBlk;
    PSZ       pszErrMsg;
    PSZ       pszOffSet;

    if (!fErrMem){
	if ((perriBlk = WinGetErrorInfo(hab)) != (PERRINFO)NULL){
	    pszOffSet = ((PSZ)perriBlk) + perriBlk->offaoffszMsg;
	    pszErrMsg = ((PSZ)perriBlk) + *((PULONG)pszOffSet);
	    WinMessageBox(HWND_DESKTOP,
			  hwndFrame,
			  (PSZ)(pszErrMsg),
			  (PSZ)szTitle,
			  0,
			  MB_MOVEABLE | MB_CUACRITICAL | MB_CANCEL );
	    WinFreeErrorInfo(perriBlk);
	    return;
	}
    } /* endif */

    MessageBox(                                                       /* ERROR */
	       hwndFrame,
	       IDS_ERROR_OUTOFMEMORY,
	       MB_MOVEABLE | MB_CUACRITICAL | MB_CANCEL,
	       TRUE);

}   /* end ReportError() */
Exemplo n.º 3
0
 int icqskin_logErrorInfo(HICQ icq, hWindow hwnd, BOOL close, char *msg)
 {
    char      buffer[0x0100];
    PERRINFO  perriErrorInfo  = WinGetErrorInfo(WinQueryAnchorBlock(hwnd));

    if(perriErrorInfo)
    {
       DBGTracex(perriErrorInfo->offaoffszMsg);

       sprintf(buffer,"%s (rc=%d/0x%04x)",perriErrorInfo->idError,perriErrorInfo->idError);
       DBGMessage(buffer);

       if(icq)
       {
          icqWriteSysLog(icq,PROJECT,buffer);
       }

       WinFreeErrorInfo(perriErrorInfo);
    }

    if(close)
    {
       icqskin_closeWindow(hwnd);
    }

    return -1;
 }
Exemplo n.º 4
0
VOID DispErrorMsg(HAB hab, HWND hwndFrame, PCH FileName, LONG LineNum)
{
    PERRINFO  pErrInfoBlk;
    PSZ       pszOffSet, pszErrMsg;
    ERRORID   ErrorId;
    PCH       ErrorStr;
    CHAR      szbuff[125];

    DosBeep(800,10);
#if defined(DEBUG)
    DosBeep(800,10);
    DosBeep(800,10);
    DosBeep(800,10);
    DosBeep(800,10);
    DosBeep(800,10);
#endif   /* defined(DEBUG) */

    if (!hab)
    {                                     /* Non-PM Error */
	WinLoadString( habMain,0, IDS_UNKNOWNMSG, sizeof(szbuff), (PSZ)szbuff);
	ErrorStr = (char*) malloc(strlen(szbuff)+strlen(FileName)+10);
	sprintf(ErrorStr, szbuff, FileName, LineNum);
	WinMessageBox(HWND_DESKTOP,         /* Parent window is desk top */
		      hwndFrame,            /* Owner window is our frame */
		      (PSZ)ErrorStr,        /* PMWIN Error message       */
		      szErrorTitle,         /* Title bar message         */
		      MSGBOXID,             /* Message identifier        */
		      MB_MOVEABLE | MB_CUACRITICAL | MB_CANCEL ); /* Flags */
	free(ErrorStr);
	return;
    }

    ErrorId = WinGetLastError(hab);

    if ((pErrInfoBlk = WinGetErrorInfo(hab)) != (PERRINFO)NULL)
    {
	pszOffSet = ((PSZ)pErrInfoBlk) + pErrInfoBlk->offaoffszMsg;
	pszErrMsg = ((PSZ)pErrInfoBlk) + *((PULONG)pszOffSet);

	WinLoadString( habMain,0, IDS_ERRORMSG, sizeof(szbuff), (PSZ)szbuff);
	ErrorStr = (char *)malloc(strlen(szbuff)+strlen(pszErrMsg)+strlen(FileName)+10);
	sprintf(ErrorStr, szbuff, pszErrMsg, FileName, LineNum);

	WinMessageBox(HWND_DESKTOP,         /* Parent window is desk top */
		      hwndFrame,            /* Owner window is our frame */
		      (PSZ)ErrorStr,        /* PMWIN Error message       */
		      szErrorTitle,         /* Title bar message         */
		      MSGBOXID,             /* Message identifier        */
		      MB_MOVEABLE | MB_CUACRITICAL | MB_CANCEL ); /* Flags */

	free(ErrorStr);

	WinFreeErrorInfo(pErrInfoBlk);
    }


}
Exemplo n.º 5
0
ULONG   PM_Error(HAB hab, HWND hwndOwner, ULONG ulWindow, ULONG ulStyle, UCHAR *pucMsg, PSZ pszErrMod, LONG lErrLine)
{
ERRORID     erroridCode;                /* Returned by WinGetLastError() */
PERRINFO    pErrInfoBlk;                /* Pointer to ERRINFO structure that is filled
                                           by WinGetErrorInfo */
PSZ         pszOffset;                  /* Pointer to the current error message returned
                                           by WinGetErrorInfo */
USHORT      usResponse;                 /* Message box return value */
                                        /* If no special test is given, assume empty string */
if(!pucMsg) pucMsg="";
sprintf(ErrBuffer, "%s\n\nModule: %s\nLinenumber: %ld\nError reported by PM: ",
    pucMsg, pszErrMod, lErrLine);

                                        /* Get the last error set by a PM function */
erroridCode=WinGetLastError(hab);
sprintf(ErrBuffer, "%s%08lX", ErrBuffer, (ULONG)erroridCode);
                                        /* Get last error for the current thread. We loop
                                           until no more error is found, although errors
                                           arn't stacked (but things may change) */
pErrInfoBlk=WinGetErrorInfo(hab);
                                        /* Do as long as there is an errorinfo available */
while(pErrInfoBlk!=(PERRINFO)NULL)
    {
                                        /* Find offset in array of message offsets */
    pszOffset = ((PSZ)pErrInfoBlk) + pErrInfoBlk->offaoffszMsg;
                                        /* Address error message in array of messages and 
                                           append error message to source code linenumber */
    strcat(ErrBuffer, "\nInfo: ");
    strcat(ErrBuffer, (((PSZ)pErrInfoBlk) + *((PSHORT)pszOffset)));
    WinFreeErrorInfo(pErrInfoBlk);      /* Free resource segment */
    pErrInfoBlk=WinGetErrorInfo(hab);
    }
                                        /* Broaden titlebar by spaces to make message box wider */
memset(Titlebar, ' ', TITLEBAR_LENGTH);
Titlebar[TITLEBAR_LENGTH-1]='\0';
memcpy(Titlebar, "PC/2: PM Error Message Information", sizeof("PC/2: PM Error Message Information")-1);
                                        /* If the user requested not to be prompted, don't display the
                                           message if it is just an informational one (in the future we
                                           might log to file) */
if((pHP!=NULL) && (pHP->ulRuntimeFlag & NOPROMPT) && (ulStyle & MB_INFORMATION))
    return(MB_OK);
                                        /* Signal to user via speaker */
if((pHP!=NULL) && !(pHP->ulRuntimeFlag & NOPROMPT))
    {
    DosBeep(1000,100);
    DosBeep(300,100);
    DosBeep(1000,200);
    }
usResponse=WinMessageBox(
    HWND_DESKTOP,                       /* Parent window is DESKTOP */
    hwndOwner,                          /* Owner window */
    (PSZ)ErrBuffer,                     /* General_Error message */
    Titlebar,                           /* Title bar message */
    (USHORT)ulWindow,                   /* Message box identifier for help */
    (USHORT)ulStyle);                   /* Message box style */
return(usResponse);
}
Exemplo n.º 6
0
static VOID AbortLocker( HWND hwndFrame, HWND hwndClient )
{
   PERRINFO     pErrInfoBlk;
   PSZ          pszOffSet;
   PSZ          pszErrMsg;

   DosBeep( 100, 10 );
   if( ( pErrInfoBlk = WinGetErrorInfo(Hab) ) != (PERRINFO)NULL ) {
      pszOffSet = ((PSZ)pErrInfoBlk) + pErrInfoBlk->offaoffszMsg;
      pszErrMsg = ((PSZ)pErrInfoBlk) + *((PSHORT)pszOffSet);
      if( (INT)hwndFrame && (INT)hwndClient ) {
         WinMessageBox(HWND_DESKTOP,         /* Parent window is desk top */
                       hwndFrame,            /* Owner window is our frame */
                       (PSZ)pszErrMsg,       /* PMWIN Error message       */
                       TRP_The_WATCOM_Debugger,      /* Title bar message         */
                       MSGBOXID,             /* Message identifier        */
                       MB_MOVEABLE | MB_CUACRITICAL | MB_CANCEL ); /* Flags */
      }
      WinFreeErrorInfo( pErrInfoBlk );
   }
   WinPostMsg( hwndClient, WM_QUIT, (MPARAM)NULL, (MPARAM)NULL );
}
Exemplo n.º 7
0
//==============================================================================
// APIError -- report an error to the user as returned from an API service.
//             This function is provided mainly as a debugging tool to report
//             API errors to the user during runtime
//==============================================================================
VOID APIError(HWND hwndFrame,HWND hwndClient)
{
      PERRINFO pErrInfoBlk;
      PSZ      pszOffSet;
      void     stdprint(void);
      PSZ      pszErrMsg;

      DosBeep(100,10);
      DosBeep(440,110);
      if ((pErrInfoBlk = WinGetErrorInfo(Main::hab)) != NULL)
      {
        pszOffSet = ((PSZ)pErrInfoBlk) + pErrInfoBlk->offaoffszMsg;
        pszErrMsg = ((PSZ)pErrInfoBlk) + *((PSHORT)pszOffSet);
        if (hwndFrame && hwndClient)
            // if our window made it as far as definition, make the error window
            // owner be our application
            WinMessageBox(HWND_DESKTOP,      // Parent window is desk top
                       hwndFrame,            // Owner window is our frame
                       (PSZ)pszErrMsg,       // PMWIN Error message
                       "API Error Message",  // Title bar message
                       64,                   // Message identifier
                       MB_MOVEABLE | MB_CUACRITICAL | MB_CANCEL ); // Flags
        else
            // if our window errored in the definition part, make the desktop
            // the owner of the error box (since we have no window to own it!)
            WinMessageBox(HWND_DESKTOP,      // Parent window is desk top
                       HWND_DESKTOP,         // Owner window is desktop
                       (PSZ)pszErrMsg,       // PMWIN Error message
                       "API Error Message",  // Title bar message
                       64,                   // Message identifier
                       MB_MOVEABLE | MB_CUACRITICAL | MB_CANCEL ); // Flags
        // Discard the saved error info once we have used it
        WinFreeErrorInfo(pErrInfoBlk);
      }
      // upon fatal error, shutdown our application
      WinPostMsg(hwndClient, WM_QUIT, (ULONG)0, (ULONG)0);
}
void OPMException::viewError()
{
 OString   err;
 PERRINFO  pErrInfoBlk;
 PSZ       pszOffset;
 CHAR      ErrBuffer[512];

 err <<  OMessage(190, OCL::MSGFILE);
 err +   "\n";
 err +   OMessage(191, OCL::MSGFILE, Source);
 sprintf(ErrBuffer, "%d", Line);
 err +   OMessage(192, OCL::MSGFILE, ErrBuffer);
 err +   OMessage(193, OCL::MSGFILE, isOfType());
 sprintf(ErrBuffer, "%d", rc);
 err +   OMessage(194, OCL::MSGFILE, ErrBuffer);
 sprintf(ErrBuffer, "%d", WinGetLastError(OApp::current().anchor()));
 err +   OMessage(197, OCL::MSGFILE, ErrBuffer);

 strcpy(ErrBuffer, "");

 while((pErrInfoBlk = WinGetErrorInfo(OApp::current().anchor())) != (PERRINFO)NULL)
  {
   pszOffset = ((PSZ)pErrInfoBlk) + pErrInfoBlk->offaoffszMsg;
   strcat(ErrBuffer, (((PSZ)pErrInfoBlk) + *((PSHORT)pszOffset)));
   WinFreeErrorInfo(pErrInfoBlk);
  }

 err +   OMessage(198, OCL::MSGFILE, ErrBuffer);

 if (!description) 
  description << OMessage(190, OCL::MSGFILE);

 err +   OMessage(195, OCL::MSGFILE, "\n", description);

 exMsg.error("Note!", err);
}