Terminates one or more running processes. This is not generally recommended, because it may cause the process in question to lose data. The preferred methods of dealing with running processes are either using the Process check option on the Installer options page, or leaving it to the installer to deal with in-use files. However, if you must terminate a process during installation, you can call KillProcess in a Run DLL action.
The KillProcess function uses a number of different methods to try and terminate the processes without data loss. If all of those methods fail, the processes are terminated by a call to the Win32 TerminateProcess function. This may still fail if the installer does not have sufficient privileges to terminate the process in question.
The KillProcess function is a predefined extension DLL function that is distributed with InstallMate. You can use this function by adding a Run DLL action to the action sequence in which you want to run the action. Set the Run DLL action attributes as follows:
- Function name: KillProcess
- Arguments: procname [procname...]
The KillProcess function expects the following arguments. All arguments may contain symbolic references; these will be resolved before the function is called. Note that you must "quote" an argument if it contains spaces, or if it could contain spaces after expansion of symbolic references.
- The name + extension of the process that must be terminated, for example notepad.exe. You may specify more than one process name in a single call by separating them with spaces.
Returns ERROR_SUCCESS (zero) if successful, else a nonzero error code. This error code is available in the LastExitCode variable.
To use this function, you must add the extension DLL to your InstallMate project. The easiest way to do so is as follows:
- Open your InstallMate project.
- Choose File > Import > Project Items... from the main menu bar.
- Browse for and select the file Insert Extension DLL.imq, then click Open.
Alternatively, you can go to the Installer options page in your InstallMate project, click on the Advanced... button, then click on the Extension DLL tab and enter the paths to the extension DLL versions there.