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