I can release my unrecoverable error 9000

I can release my unrecoverable error 9000

Postby fafi » Wed Nov 18, 2009 7:48 am

Thanks to Mr. Antonio

Put in your main program :

Code: Select all  Expand view


#pragma BEGINDUMP  

#include "hbapifs.h"
#include "hbapilng.h"
#include <windows.h>

void hb_errInternal( ULONG ulIntCode, const char * szText, const char * szPar1, const char * szPar2 )
{
   char title[64], buffer[ 1024 ];
   FILE *fpError;
   BOOL bLang;

   HB_TRACE(HB_TR_DEBUG, ("hb_errInternal(%lu, %s, %s, %s)", ulIntCode, szText, szPar1, szPar2));

   if( strncmp( szText, "Module:", 7 ) == 0 ) // pcode version
      return;

   bLang = ( hb_langID() != NULL );

   if( szText )
   {
      fpError = hb_fopen( "error.log", "a" );

      if( fpError )
      {
         fclose( fpError );
         TraceLog( "error.log", szText, szPar1, szPar2 );
      }
   }

   hb_conOutErr( hb_conNewLine(), 0 );

   hb_snprintf( title, sizeof( title ), bLang ?
                      ( char * ) hb_langDGetItem( HB_LANG_ITEM_BASE_ERRINTR ) :
                      "Unrecoverable error %lu: ", ulIntCode );

   hb_conOutErr( title, 0 );

   if( szText != NULL )
   {
      hb_snprintf( buffer, sizeof( buffer ), szText, szPar1, szPar2 );
   }
   else if (bLang)
   {
      hb_snprintf( buffer, sizeof( buffer ), ( char * ) hb_langDGetItem( HB_LANG_ITEM_BASE_ERRINTR + ulIntCode - 9000 ), szPar1, szPar2 );
   }

   hb_conOutErr( buffer, 0 );
   hb_conOutErr( hb_conNewLine(), 0 );
   hb_stackDispCall();

   #ifdef HB_OS_WIN_32
      MessageBox( NULL, buffer, title, MB_ICONSTOP );
   #endif

   /* release console settings */
   hb_conRelease();

   if( hb_cmdargCheck( "ERRGPF" ) )
   {
       int *pGPF = NULL;
       *pGPF = 0;
       *(--pGPF) = 0;
   }

   #if defined( HB_THREAD_SUPPORT ) && defined( HB_OS_OS2 )
      /* Post all threads waiting on an indefinite wait */
      DosPostEventSem(hb_hevWakeUpAll);
      /* Let's give them some time to wake up */
      DosSleep(5000);
      /* Stop VM, I cannot call exit() here or I end up with a zombie process */
      hb_vmQuit();
   #endif

   exit( EXIT_FAILURE );
}
#pragma ENDDUMP  


 


Regards
Fafi
User avatar
fafi
 
Posts: 169
Joined: Mon Feb 25, 2008 2:42 am

Re: I can release my unrecoverable error 9000

Postby Antonio Linares » Thu Nov 19, 2009 11:47 am

Fafi,

This code is an extreme workaround and it not advisable to use it :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 92 guests