I have a InnoSetup project that I want to check if the application is actually running before uninstalling it. I tried many ways but it all fails silently when running in Windows 7. For example the following script that checks for notepad.exe process using psvince.dll always returns false regardless of notepad being running or not.
I used psvince.dll in a C# app to check if it works under Windows 7 and it works without any problem so my best guess is that installer can not run correctly with UAC enabled.
[Code]
function IsModuleLoaded(modulename: String ): Boolean;
external 'IsModuleLoaded@files:psvince.dll stdcall';
function InitializeSetup(): Boolean;
begin
if(Not IsModuleLoaded('ePub.exe')) then
begin
MsgBox('Application is not running.', mbInformation, MB_OK);
Result := true;
end
else
begin
MsgBox('Application is already running. Close it before uninstalling.', mbInformation, MB_OK);
Result := false;
end
end;