JanB
28th June 2013 10:41 UTC
Uninstaller // Check if exe is running
Hello,
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
Jan
aerDNA
28th June 2013 12:22 UTC
You can use one of the process plugins but the simplest way, if your software is a classic gui-based app, is like this:
IsProgramRunning:
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
ProgramNotRunning:
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.