Estou usando DIALOG dentro de uma WINDOW MDICHILD e está me ocorrendo erro de GPF. Simulei o erro usando o sample \fwh\samples\testmdix.prg. Veja o exemplo abaixo:
// This is an example of how to place controls inside a MDIChild
// from a dialog built from source code
#include "FiveWin.ch"
static oWnd
//----------------------------------------------------------------------------//
function Main()
local oBar
SET _3DLOOK ON
DEFINE WINDOW oWnd TITLE "MDIChilds from resources" MDI
DEFINE BUTTONBAR oBar _3D OF oWnd
DEFINE BUTTON OF oBar ACTION ( Child(), MsgInfo( oWnd:oWndClient:aWnd[ 1 ]:cCaption ) )
ACTIVATE WINDOW oWnd
return nil
//----------------------------------------------------------------------------//
function Child()
local oWndChild, oDlg, oBtn
local cName := "Testing..."
DEFINE WINDOW oWndChild MDICHILD OF oWnd ;
COLOR "N/W"
oWndChild:bGotFocus = { || oDlg:SetFocus() }
DEFINE DIALOG oDlg FROM 0, 0 TO 10, 20 ;
STYLE WS_CHILD OF oWndChild
oDlg:bLostFocus = { || MsgBeep() }
@ 2, 2 BUTTON "&Ok" OF oDlg ACTION MsgInfo( "Click" )
ACTIVATE DIALOG oDlg NOWAIT ; // It has to be NonModal --> NOWAIT clause
ON INIT oDlg:Move( 0, 0 )
ACTIVATE WINDOW oWndChild ;
ON INIT oWndChild:SetSize( oDlg:nWidth, oDlg:nHeight )
A += 1 && Aqui simulo o erro
return nil
//----------------------------------------------------------------------------//
Ao executar a linha "A += 1" é retornada a tela de erro padrão de FWH e em seguida ocorre o erro de GPF abaixo:
if lRet == nil .or. ( !LWRunning() .and. lRet )
SET RESOURCES TO
ErrorLevel( 1 )
// NEW !!!
for n = 1 to Len( GetAllWin() )
if ValType( GetAllWin()[ n ] ) == "O"
GetAllWin()[ n ]:UnLink()
endif
next
// NEW !!!
QUIT // must be QUIT !!!
endif
External _fwGenError // Link FiveWin generic Error Objects Generator
#Define NTRIM(n) ( LTrim( Str( n ) ) )
#Ifdef __CLIPPER__
#define DLG_TITLE "FiveWin: The CA-Clipper For Windows Library"
#Else
#Ifdef __XHARBOUR__
#define DLG_TITLE "FiveWin For [x]Harbour-Erros de GPF"
#Else
#define DLG_TITLE "FiveWin For Xbase++"
#Endif
#Endif
/*************
* ErrorSys()
*
* Note: automatically executes at startup
*/
proc ErrorSys()
ErrorBlock( { | e | ErrorDialog( e ) } )
return
proc ErrorLink()
return
/*************
* ErrorDialog()
*/
static function ErrorDialog( e ) // -> logical or quits App.
local oDlg, oLbx, oFont, oWnd
local lRet // if lRet == nil -> default action: QUIT
local n, j, cMessage, aStack := {}
local oSay, hLogo
local nButtons := 1
local cErrorLog := ""
local aVersions := GetVersion()
local aTasks
local aRDDs, nTarget, uValue
local oOldError
local cRelation
local lIsWinNT := IsWinNT()
// by default, division by zero yields zero
if ( e:genCode == EG_ZERODIV )
return 0
end
// for network open error, set NETERR() and subsystem default
if ( e:genCode == EG_OPEN .and. ;
( e:osCode == 32 .or. e:osCode == 5 ) .and. ;
e:canDefault )
NetErr( .t. )
return .f. // Warning: Exiting!
end
// for lock error during APPEND BLANK, set NETERR() and subsystem default
if ( e:genCode == EG_APPENDLOCK .and. e:canDefault )
NetErr( .t. )
return .f. // OJO SALIDA
endif
if Left( ProcName( 7 ), 10 ) == "ERRORDIALO"
DBCLOSEALL()
SET RESOURCES TO
ErrorLevel( 1 )
// "Exibindo a barra de tarefas"
ShowWindow(FindWindow( 'Shell_TrayWnd',Nil), SW_SHOWNA)
oWnd:End()
__QUIT()
endif
ErrorBlock( {|e| ( MsgStop( OemToAnsi( ErrorMessage(e) ), "Mensagem de Erro" )+;
" Linha do Erro: " + ;
Str( ProcLine( 1 ), 3 ) ), __Quit() } )
// Error object analysis
cMessage = " Descri‡Æo do Erro: " + ErrorMessage( e ) + CRLF
cErrorLog += cMessage
if ValType( e:Args ) == "A"
cErrorLog += " Argumentos:" + CRLF
for n = 1 to Len( e:Args )
cErrorLog += " [" + Str( n, 4 ) + "] = " + ValType( e:Args[ n ] ) + ;
" " + cValToChar( e:Args[ n ] ) + CRLF
next
endif
cErrorLog += CRLF + "Chamada da Pilha: " + CRLF
cErrorLog += "================= " + CRLF
n := 2 // we don't disscard any info again !
while ( n < 74 )
if ! Empty(ProcName( n ) )
AAdd( aStack, " Chamada De: " + Trim( ProcName( n ) ) + ;
"(" + NTRIM( ProcLine( n ) ) + ")" )
cErrorLog += ATail( aStack ) + CRLF
endif
n++
end
If lRet == Nil .Or. ( !LWRunning() .And. lRet )
DBCLOSEALL()
SET RESOURCES TO
ErrorLevel( 1 )
/*
Rossine,
Please add these lines in source\function\errsysw.prg:
Código:
*/
//-> Novo, By Antonio Linares - Incorporei em 22/01/2007 - JoÆo
//-> NEW !!! Forum Internacional, Antonio Linares.
//-> Corre‡Æo de Estouro de Pilha.
FOR n = 1 TO LEN( GetAllWin() )
IF ValType( GetAllWin()[ n ] ) == "O"
GetAllWin()[ n ]:UnLink()
ENDIF
NEXT
// "Exibindo a barra de tarefas"
ShowWindow(FindWindow( 'Shell_TrayWnd',Nil), SW_SHOWNA)
oWnd:End()
__QUIT() // must be QUIT !!!
Else
DBCLOSEALL()
SET RESOURCES TO
ErrorLevel( 1 )
/*
Rossine,
Please add these lines in source\function\errsysw.prg:
Código:
*/
//-> Novo, By Antonio Linares - Incorporei em 22/01/2007 - JoÆo
//-> NEW !!! Forum Internacional, Antonio Linares.
//-> Corre‡Æo de Estouro de Pilha.
FOR n = 1 TO LEN( GetAllWin() )
IF ValType( GetAllWin()[ n ] ) == "O"
GetAllWin()[ n ]:UnLink()
ENDIF
NEXT
// "Exibindo a barra de tarefas"
ShowWindow(FindWindow( 'Shell_TrayWnd',Nil), SW_SHOWNA)
oWnd:End()
__QUIT() // must be QUIT !!!
...
static function exit_all( e, lRetry )
if lRetry
MsgStop( ErrorMessage(e) + " from Errorsys, line:" + ;
Str( ProcLine( 1 ), 3 ) )
endif
SET RESOURCES TO
ErrorLevel( 1 )
for n = Len( GetAllWin() ) to 1 step -1
if ValType( GetAllWin()[ n ] ) == "O"
GetAllWin()[ n ]:End()
endif
next
sysrefresh()
QUIT
//----------------------------------------------------------------------------//
...