What is the best way to end any application?
I'm using this way:
Code: Select all
PostQuitMessage (0)
__quit ()
Code: Select all
PostQuitMessage (0)
__quit ()
Thanks Linares but, something it's happening... I using a user function for a dialog confirmation to end the application.Antonio Linares wrote:The right way to end the application is to :End() the main window (or dialog):
oWnd:End()
Code: Select all
#include "FiveWin.ch"
function Main()
local oWnd
DEFINE WINDOW oWnd TITLE "Test"
ACTIVATE WINDOW oWnd ;
VALID ConfirmExit()
return nil
function ConfirmExit()
local oDlg, lExit := .F.
DEFINE DIALOG oDlg TITLE "Please confirm"
@ 1, 1 SAY "Do you want to exit ?"
@ 3, 1 BUTTON "Yes" ACTION ( oDlg:End(), lExit := .T. )
@ 3, 8 BUTTON "No" ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTERED
return lExit
Linares... is here -> http://rapidshare.com/files/106356753/app.prg.htmlAntonio Linares wrote:Júlio,
Please try to provide me a small PRG that reproduces the way you are doing it. Thanks,
Ok Antonio! I go to do!Antonio Linares wrote:Júlio,
The example that I have provided you, it can be built and tested. Have you tested it ?
Your provided PRG can't be built here (missing resources, variables and functions).
Please understand that in order to provide tech support we need your cooperation providing ready to be built PRG code, thanks
Hi Antonio...Antonio Linares wrote:The right way to end the application is to :End() the main window (or dialog):
oWnd:End()
Code: Select all
FUNCTION endApp( lConfirm, lForce )
LOCAL lEndApp := .F.
LOCAL nAllWin := 0
LOCAL aAllWin := {}
LOCAL nPos := 0
DEFAULT lConfirm := .T.
DEFAULT lForce := .F.
IF lConfirm
lEndApp := msgDialogBox( "Finish application?", "System", MSG_YESNO )
ENDIF
IF lEndApp .OR. lForce
oSIS_Conection:freeResult( .T. )
oSIS_Conection:clean()
oSIS_Conection:disconnect()
oSIS_Conexao := NIL
resAllFree()
ENDIF
IF lForce
( getWnd() ):bValid := {|| .T. }
nAllWin := nWindows()
aAllWin := getAllWin()
FOR nPos := 1 TO nAllWin
aAllWin[nPos]:end()
NEXT
( getWnd() ):end()
ENDIF
RETURN( lResultado )
RETURN( lEndApp )
Code: Select all
FUNCTION getWnd()
RETURN( oWndFromhWnd( findWindow( 0, "window title" ) ) )