Inno Setup fails to remove components during uninstall cause my program is still running and the executable cannot be deleted. How do I have it check to see if it is running before allowing uninstall to proceed?
views:
800answers:
1
+5
A:
Check these
Inno Setup: Detect instances running in any user session with AppMutex
Inno Setup: Is application running?
Inno Setup: Detect if an application is running
There are several ways. If your program defines a mutex use
[Setup]
AppMutex=MyMutexName
or for a specified mutex in the Code
section
function CheckForMutexes (Mutexes: String): Boolean;
You could also use
function FindWindowByClassName (const ClassName: String): Longint;
to get the window handle by class name and send it messages.
Or get it by the name
function FindWindowByWindowName (const WindowName: String): Longint;
Or you use one of several DLL files for this specific use case
Or do it yourself after reading
How To Terminate an Application "Cleanly" in Win32
How To Enumerate Applications Using Win32 APIs (this one links to the german version as for some reason I can't find the english version of KB175030
or try the google translated version of the KB175030-DE
jitter
2009-10-16 09:41:53
Awesome answer. Very thorough; thank you! The global mutex option took 5 minutes to get it right! Nothing better than that.
max
2009-10-20 06:26:55