Inno Setup. Detect if an EXE is running

I have a pretty simple Inno  setup script.   It installs some Exe's and Dll's  on a client PC.  I  want to check if 2 exe's are running  before the installation  proceeds  so I can notify the user to manually shut them before continuing.  I do not want to proceed and use the restartreplace flag.

I think I can add it to the CurStepChanged procedure but I can  find no function in Inno like   IsApplicationRunning(test.exe)...

Help please....
SarusSystemsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

matrixnzCommented:
I normally do i with AutoIT it's alot simpler than just include it within the InnoSetup Install

An AutoIT Script would look something like code snippet below.  The message will continue to loop until the processes are closed.

AutoIT is free and can be downloaded from http://www.autoitscript.com/autoit3/downloads.shtml also recommend downloading the AutoIT Script Editor as well found on the same page.

After installing, just save the code below to a new file and call it ProcessClose.au3 (for example) right click the file and select compile script.

That's it, you should find ProcessClose.exe in the same directory.

Hope that helps.

Cheers
#NoTrayIcon
 
While 1
	$PROCESS1 = ProcessExists('process1.exe')
	$PROCESS2 = ProcessExists('process2.exe')
	If $PROCESS1 Then
		MsgBox(0,'Error', 'Please Close Application1')
	ElseIf $PROCESS2 Then
		MsgBox(0,'Error', 'Please Close Application2')
	Else
		ExitLoop
	EndIf
WEnd

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SarusSystemsAuthor Commented:
Thanks. I really need it as part of an Inno script.   Can I  integrate this into Inno?
0
matrixnzCommented:
You can easily call it for example if it's in the same folder using {src} otherwise if you solely wish to use innosetup than lookup mutexes, CheckForMutexes
0
SarusSystemsAuthor Commented:
Many Thanks.  Another solution  is at http://www.vincenzo.net/isxkb/index.php?title=Call_psvince.dll_on_install_and_uninstall

[Files]
Source: ..\source\psvince.dll; Flags: dontcopy

[Code]
(* We declare variables in var section. Inno Setup use Pascal as its script *)
function IsModuleLoaded(modulename: String ):  Boolean; external 'IsModuleLoaded@files:psvince.dll stdcall';


function InitializeSetup(): Boolean;
begin

  // check if notepad is running
  if IsModuleLoaded( 'notepad.exe' ) then
  begin
    MsgBox( 'Notepad is running, please close it and run again setup.',
             mbError, MB_OK );
    Result := false;
  end
  else Result := true;
end;
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.