RFUSRAPP.ExitToApp (DOS legacy)

boolean ExitToApp(long nSaveFlag, long nCleanFlag)

Function ExitToApp(nSaveFlag As Long, nCleanFlag As Long) As Boolean

Closes the RF connection and exits the client program to the user local application (if requested) and cleans other files (if requested).

Return value
True=successful, False=error, RF link lost, etc.

Parameters

nSaveFlag
    Only one of the following constants.

Constant Meaning
WLUA_SAVEONLY At exit, save the downloaded files (if any) from the temporary RAM drive (D:) into the FLASH drive (E:), then return to the client application.
WLUA_SAVEANDRUN At exit, save the downloaded files (if any) from the temporary RAM drive (D:) into the FLASH drive (E:), then launch the user local application.

nCleanFlag
    Only one of the following constants.

Constant Meaning
WLUA_CLEANNO Do not delete any files stored in the application folder in the FLASH drive (E:\USRAPP).
WLUA_CLEANYES Before saving downloaded files, clean (empty) the application folder in the FLASH drive (E:\USRAPP).
Clean process is done if there is any file to save.

Remarks
The clean, save and run processes are performed at exit time.
The RF connection is lost. After this command, do not perform any WireLess Studio function.
(DOS legacy)

Example
' Updates and run an application, allows the user to launch from menu.

Public wsRfIo As New RFIO
Public wsRfUsrApp As New RFUSRAPP
Dim iRes As Integer


Public Sub Main()

'--------------------------------------------------
' The user applicaiton when exit by F9 or after update
wsRfUsrApp.SetExitApp "SCANNING.EXE", "MASS SCAN"

'--------------------------------------------------
' Update applicaitons
' 0=RF Error, Transfer error
' 1=Don't needs update
' 2=Please, close the application to allow save and run
wsRfIo.RFPrint 0, 7, "Updating ...", WLNORMAL + WLFLUSHOUTPUT
iRes = wsRfUsrApp.UpdateApp("C:\MyApps", WLUA_SAVEANDRUN, WLUA_CLEANNO)
' Error
If iRes = 0 Then
    wsRfError.ClearError
    wsRfError.SetErrorLine "UPDATE", 0
    wsRfError.SetErrorLine "ERROR", 1
    wsRfError.Display 0
    GoTo EndProgram
End If

' Not updated (files up-to-date),
' exit to app w/o file transfer to run
If iRes = 1 Then
    wsRfUsrApp.ExitToApp WLUA_SAVEANDRUN, WLUA_CLEANNO
End If

' Here the RF connection is lost, exit the program
EndProgram:
End Sub

See also    RFUSRAPP, UpdateApp, SetExitApp