short UpdateApp(BSTR sAppDir, long nSaveFlag, long nCleanFlag)
Function UpdateApp(sAppDir As String, nSaveFlag As Long, nCleanFlag As Long) As Integer
High level function to conditionally download application files.
Return value
0=Error, Transfer error, RF link lost, etc.
1=successful, doesn't need update (all the files are up-to-date), exit if you wish to
run application.
2=successful, please close the application to allow the save, clean and run processes
(RF link closed). ExitToApp function is performed.
Parameters
sAppDir
The name of the folder in the host PC that contains the files
belonging to the application.
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 client
application. If set to WLUA_SAVEONLY, the ExitToApp function is not performed if there is not update to do (returns 1). |
| 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. If the clean flag is set, all the files are downloaded if any file needs to be updated. |
Remarks
The save, clean and run processes are performed at exit time.
The method examines the files in the client memory (FLASH disk), and if any file
needs to be loaded (does not exist, size, date or time changes) downloads the file.
If the clean flag is set, all the files are downloaded if any file needs to be
updated.
If the nSaveFlag is set to WLUA_SAVEONLY, the ExitToApp function is not
performed if there is not update to do (return 1).
Set the exit application before calling this function by SetExitApp.
(DOS legacy)
Example
' Updates and runs 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, ExitToApp, SetExitApp