Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Detect if an application is running


2 replies to this topic

anguslee

anguslee
  • Members
  • 1 posts

Posted 03 December 2003 - 16:15

Hi,

I'm new to Windows Installer. I use Orca to edit Msi file. Is there any way for me to detect if an application is running during install? Thank you.

Angus Lee

luke_s

luke_s
  • Full Members
  • 532 posts

Posted 04 December 2003 - 08:06

You will need to create a custom action to check the process list and see if your app is running.

You can add a custom action DLL(c/c++), add it to the binary table, and then setup the custom action table with the new action.



TobiasEriksson

TobiasEriksson
  • Members
  • 16 posts

Posted 30 December 2003 - 10:11

Hi
I came across this script some time agoe and I think this will do the trick for ya. There are of course other ways of doing this, but this is at least one way.
I've copied this script almost right as it is from the following web site:
http://www.rgagnon.c...s/wsh-0020.html
so he(they) should have all the credits.


To determine if your application is running when you are about to
install an upgrade for example you can use the script below. Well,
this is just a stub, you need to make changes in order to fit your
needs, like setting an MSI variable or poping up a dialog like I did
below.

***************************
Set WshShell = WScript.CreateObject("WScript.Shell")

Set locator = CreateObject("WbemScripting.SWbemLocator")
Set service = locator.ConnectServer()
Set props = service.ExecQuery("select name, description from
Win32_Process where name = 'program.exe'")
num = props.Count

If num > 0 Then
'Program is running
MsgBox "AFP is running!"
Else
'Program is not running
MsGBox "AFP is NOT running!"
End If

Set WSHShell = Nothing
**************************

Regards
Tobias