Upon upgrade of my app, I want to kill the process of the previous version is it's running. I also give no option but to run the app upon final "Finish" button click.
Is this still the recommended approach to that? : http://www.advancedinstaller.com/user-g ... ocess.html
In the following code from that page, the objname declaration and assignment (lines 3 and 10) seem pointless. Am I missing something?
~~~~~~~~~
Dim objWMIService, objProcess, colProcess
Dim strComputer
Dim objname
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
strProcessKill = "'AdvancedInstaller.exe'"
Set colProcess = objWMIService.ExecQuery("Select * from Win32_Process Where Name = " & strProcessKill)
For Each objProcess in colProcess
objname = objProcess.Name
If objProcess.Name = "AdvancedInstaller.exe" then
objProcess.Terminate()
End If
Next
~~~~~~~~~
Also, will this code kill the process only in the current session, or will it also kill the process if it is running in other sessions on the same machine?
FOLLOW US
Get the latest news in Application Packaging