FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Catching GPF's
Posts: 172
Joined: Fri Oct 07, 2005 01:29 PM
Catching GPF's
Posted: Mon Jan 23, 2006 07:47 AM

Hi.

I'm looking at catching GPF's in xHarbour using SetUnhandledExceptionfilter. Has anybody done this already that can provide me with a sample?

Thanks,
Alex

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Catching GPF's
Posted: Mon Jan 23, 2006 08:37 AM
Alex,

If you use the xHarbour build we provide from www.fivetechsoft.com/files/xharbour.exe it already include GPFs catching using SetUnhandledExceptionfilter().

Both Harbour and xHarbour already include support for SetUnhandledExceptionfilter() but you have to build them using this flag: -DHB_INCLUDE_WINEXCHANDLER

Also in xharbour this fix is needed in source\vm\mainwin.c:

int WINAPI WinMain( HINSTANCE hInstance,      /* handle to current instance */
                    HINSTANCE hPrevInstance,  /* handle to previous instance */
                    LPSTR lpCmdLine,          /* pointer to command line */
                    int iCmdShow )            /* show state of window */
{
   #ifdef HB_INCLUDE_WINEXCHANDLER
      LONG WINAPI hb_UnhandledExceptionFilter( struct _EXCEPTION_POINTERS * ExceptionInfo );
      
      LPTOP_LEVEL_EXCEPTION_FILTER ef = SetUnhandledExceptionFilter( hb_UnhandledExceptionFilter );
   #endif


And rename UnhandledExceptionFilter() as hb_UnhandledExceptionFilter() in source\vm\estack.c.

This code is already included in Harbour CVS files, but it is not in xharbour CVS.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 172
Joined: Fri Oct 07, 2005 01:29 PM
xHarbour gpf's
Posted: Mon Jan 23, 2006 08:40 AM

We're currently using the commercial version of xHarbour. I'll see what I can find out from their newsgroup.

Alex

Continue the discussion