Controle de GPFs

Discussão sobre a biblioteca Fivewin - O Clipper para Windows.

Moderador: Moderadores

Kapiaba
Colaborador
Colaborador
Mensagens: 1908
Registrado em: 07 Dez 2012 16:14
Localização: São Paulo
Contato:

Controle de GPFs

Mensagem por Kapiaba »

Alguém pode testar esta função, com meu FWH não está funcionando, quebra o programa aqui: + Str( aTimerInfo[ 1 ] )

Código: Selecionar todos

// Testing Windows ToolHelp.dll

#include "FiveWin.ch"

//----------------------------------------------------------------------------//

function Main()

   local aTimerInfo := TimerCount()

   // Determining how long an application has been running

   MsgInfo( "Milliseconds since this task started: " + Str( aTimerInfo[ 1 ] ) )
   MsgInfo( "Milliseconds since the VM started:    " + Str( aTimerInfo[ 2 ] ) )

   // Controlling possible GPFs !!!

   InterruptRegister( { || ControlGPF() } )  // Setting our own GPF controller
   // Comment the above function and see the difference !

   __GenGPF()                                // Now we generate a GPF !!!

return nil

//----------------------------------------------------------------------------//

function ControlGPF()

   MsgAlert( "A GPF has occurred" + CRLF + "I am URGENTLY closing everything!" )

   // CLOSE ALL           --> Here we close all our files !!!

   MsgInfo( "We recommend reboot the computer, or at least exit Windows" )

   InterruptUnRegister()   // We release our GPF controller

   Eval( ErrorBlock(), _FWGenError( 5, "Undetermined GPF" ) )
                                   // you can use the FiveWin
                                   // Error SubSystem !!!

return nil


/*
Application
===========
   Path and name: C:\FWH1306\samples\TESTE.exe (32 bits)
   Size: 2,408,960 bytes
   Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20150419)
   FiveWin  Version: FWHX 13.05
   Windows version: 6.1, Build 7601 Service Pack 1

   Time from start: 0 hours 0 mins 0 secs 
   Error occurred at: 05/14/15, 10:32:35
   Error description: Error BASE/1068  Argument error: array access
   Args:
     [   1] = U   
     [   2] = N   2

Stack Calls
===========
   Called from: TESTE.prg => MAIN( 14 )
*/
Obg. abs.
Responder