Forced closing function
Posted: Sun Dec 08, 2013 8:33 pm
Is there a way to Alaska to forcibly close a specific function previously running with the command from another function?
Donnay Software Web Forums
http://bb.mobile.donnay-software.com/Donnay/
http://bb.mobile.donnay-software.com/Donnay/viewtopic.php?f=2&t=1167
Code: Select all
Function Function1()
DO WHILE RunThisFunc()
* Code
ENDDO
RETURN NIL
FUNCTION RunThisFunc(lSetRun)
STATIC RunIt := .T.
IF PCount()=1
RunIt := lSetRun
ENDIF
RETURN RunIt
you just can "kill a Task" ... but it does not say what will happens with your Data !Eugene Lutsenko wrote:In other words the software to do what we can do manually in Task Manager when forcibly stop the program, but the program and function.
CLOSE ALL will close all Database in one WorkSpaceArea.Eugene Lutsenko wrote:Thus it is desirable to open all database function interrupted closed at the termination of its operation.
Code: Select all
PROCEDURE AppExit()
LOCAL bErrorHandler :=ErrorBlock( {|e| Break(e)} )
LOCAL aWS, i
/*
* Absichern der shutdown-sequence vor rekursiven Fehlern
* in DbCommit() udgl.
*/
aWS := WorkSpaceList()
FOR i:= 1 TO len(aWS)
BEGIN SEQUENCE
/*
* Erzwinge das erfolgreiche Beenden aller
* anstehenden Record updates im aktuellen
* Workspace.
*/
(aWS[i])->(DbCommit())
(aWS[i])->(DbCloseArea())
RECOVER
(aWS[i])->(DbRRollback())
(aWS[i])->(DbCloseArea())
ENDSEQUENCE
NEXT
ErrorBlock( bErrorHandler )
RETURN
i say it again : if you do not "close" your Database before "kill Task" your Data will be corrupt !!!Eugene Lutsenko wrote:And as I can "kill task", ie close the previously executed function from another function. With these all will be fine, as I can before closing all databases
Code: Select all
Function KillWindow(cTitle)
LOCAL hWndDlg
hWndDlg := DllCall( "User32.dll", DLL_STDCALL, "FindWindowA", 0, cTitle )
IF !( hWndDlg == 0 )
SendMessageA( hWndDlg, WM_QUIT, 0, 0 )
ENDIF
Code: Select all
nEvent := AppEvent ( @mp1, @mp2, @oXbp )
DO CASE
CASE nEvent == xbeP_Quit
QUIT // AppQuit()
CASE ...
OTHERWISE
oXbp:HandleEvent ( nEvent, mp1, mp2 )
ENDCASE