Sys_TerminateApplication
Description
Section titled “Description”The function can be used to stop an application in a user friendly manner before an installation is started. The function shows a message that asks the user to close the application, and checks every 10 seconds if the process is still running. When the process has ended, the function completes.
If the process is still running after the timeout, the function shows a message that the installation timed out and will be retried later, and calls CMS_JobRetryLater. The rest of the installation is then skipped, and the package runs again later.
The function shows the message also if the process isn’t running. To only ask the user when the application is open, call Sys_ExistProcess first.
The texts of the messages come from Capalib.ini in the Lib folder of the CapaInstaller client, in the language of the job (gsLanguage).
Syntax
Section titled “Syntax”Sys_TerminateApplication(sName, sProcess, iTimeOut) As Boolean
Parameters
Section titled “Parameters”sName (String)
Section titled “sName (String)”Application name. Free text that is inserted into the message the user sees
sProcess (String)
Section titled “sProcess (String)”File name of the process to wait for, for example CapaInstaller.exe
iTimeOut (Integer)
Section titled “iTimeOut (Integer)”Number of minutes the user has to close the application
Return value
Section titled “Return value”The function returns False if the process is still running after the timeout.
Example
Section titled “Example”If bStatus Then bStatus = Sys_ExistProcess("CapaInstaller.exe", False)If bStatus And gbValue Then bStatus = Sys_TerminateApplication("CapaInstaller", "CapaInstaller.exe", 1)Related functions
Section titled “Related functions”Sys_ExistProcess CMS_JobRetryLater Constants Package Property Variables