Archive: Uninstaller // Check if exe is running


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


http://nsis.sourceforge.net/Check_wh...ion_is_running
http://nsis.sourceforge.net/LockedList_plug-in


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.