Is there a function that closes all open or used files?
There are wonderful functions: CLoseAll() and Close AllWindows(). But we also need the CloseAllFiles() function
Code: Select all
******************************************************************************************
Function CLoseAll() // Закрытие всех баз данных с ожиданием завершения операций
******************************************************************************************
LOCAL bError , aWorkareas , x, y
bError := ErrorBlock( {|e| Break(e)} )
aWorkAreas := workspacelist()
y := len(aWorkAreas)
for x = 1 to y
BEGIN SEQUENCE
(aWorkAreas[x])->(DbClearRelation())
(aWorkAreas[x])->(DbCloseArea())
ENDSEQUENCE
next
ErrorBlock(bError)
bError := nil
Return nil
Code: Select all
************************************************************************************
******** Закрыть все процессы от Роджера
************************************************************************************
FUNCTION CloseAllWindows()
LOCAL i, aChildList, nSeconds := Seconds()
DO WHILE !Empty( aChildList := Set_MainWindow():drawingArea:childList())
FOR i := 1 TO Len(aChildList)
IF !aChildList[i]:isDerivedFrom('XbpDialog')
aChildList[i]:destroy()
ELSE
PostAppEvent(xbeP_Close,,,aChildList[i])
ENDIF
Sleep(10)
NEXT
IF Seconds() - nSeconds > 10
EXIT
ENDIF
ENDDO
Sleep(10)
RETURN nil
************************************************************************************