What is the best way to end any application?
I'm using this way:
- Code: Select all Expand view RUN
PostQuitMessage (0)
__quit ()
Thanks at all!
PostQuitMessage (0)
__quit ()
Antonio Linares wrote:The right way to end the application is to :End() the main window (or dialog):
oWnd:End()
#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
Antonio Linares wrote:Júlio,
Please try to provide me a small PRG that reproduces the way you are doing it. Thanks,
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
Antonio Linares wrote:The right way to end the application is to :End() the main window (or dialog):
oWnd:End()
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 )
FUNCTION getWnd()
RETURN( oWndFromhWnd( findWindow( 0, "window title" ) ) )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: wilsongamboa and 96 guests