Archive: Uninstaller // Check if exe is running

Uninstaller // Check if exe is running

i have programmed an installer/uninstaller for a self-developed software.
When the installer will be started, it will check if the software is already installed.
When the software is already installed it will first delete the installed software and second install the new software. This runs well.

The only problem i still have is: How can i check if the software is running... (Problem: The uninstaller can't uninstall the running .exe)

Many thanks in advance


You can use one of the process plugins but the simplest way, if your software is a classic gui-based app, is like this:

FindWindow $0 "WindowClass" "WindowTitle"
IntCmp $0 0 ProgramNotRunning
System::Call 'User32::PostMessage(i,i,i,i) i($0,${WM_CLOSE},0,0)'
Sleep 1000
Goto IsProgramRunning

Edit: this particular example will get caught in a loop if the software being closed prompts user with something (e.g. "do you want to save before exiting"). If that's a possibility, you should throw in a messagebox or two.