cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sks2004
Level 4

Close running process

I've utilized the following ideas obtained from http://www.installsite.org/pages/en/isp_ext.htm to close a running application upon uninstall (an EXE that lives within the System Tray), but it doesn't work on Vista, if uninstalling via Programs and Features- Uninstall.

What would be a more modern approach to closing a running application upon uninstall?

btw, if you follow the link, look for: List and Shut Down Running Applications
Labels (1)
0 Kudos
(2) Replies
klacounte
Level 6

I didn't look at the code sample but I can give you some options.

One way is to send a WM_CLOSE message to the applications main window. This will require you to find the window handle but FindWindow in the Windows API should work well.

Another way is to call TerminateProcess. This requires the process handle so you'll need to use EnumProcesses to find the application.
0 Kudos
Stefan_Krueger
Level 9

Where in the sequence are you calling the custom action? Should be in the Install execute sequence. It may require elevated permissions so try "deferred in system context".
Stefan Krueger
InstallSite.org
0 Kudos