Detect if an application is running

From ISXKB

(Difference between revisions)
Jump to: navigation, search
(See also)
Line 12: Line 12:
to check for a specified mutex, to see which mutexes are created by an application you can use [http://www.microsoft.com/technet/sysinternals/ProcessesAndThreads/ProcessExplorer.mspx ProcessExplorer].
to check for a specified mutex, to see which mutexes are created by an application you can use [http://www.microsoft.com/technet/sysinternals/ProcessesAndThreads/ProcessExplorer.mspx ProcessExplorer].
 +
 +
Most likeley the easiest and best way to handle application mutexes is by adding the 'AppMutex' directive to the Inno Setup script's [Setup] section.
 +
<pre>
 +
[Setup]
 +
AppMutex=MyMutexName
 +
</pre>
 +
See the topic [[#Application_is_running|Application_considerations Application is running]] in the article [[Application_considerations]] and Inno Setup's help file for more info.
== Checking for a Class Name ==
== Checking for a Class Name ==
Line 31: Line 38:
*[[Application considerations]]
*[[Application considerations]]
*[[Files in use extension]]
*[[Files in use extension]]
 +
 +
== External links ==
 +
*[http://www.jrsoftware.org/iskb.php?mutexsessions Inno Setup Knowledge Base] Detect instances running in any user session with AppMutex
[[Category:Applications]]
[[Category:Applications]]
[[Category:Process Functions]]
[[Category:Process Functions]]

Revision as of 18:54, 29 August 2007

There are many ways to do that, looking for a mutex, a class, a window or a runnnig exe.

See also HOWTO: Detect instances running in any user session with AppMutex on Inno Setup Knowledge Base.


Contents


Checking for a Mutex

It is possible to use

function CheckForMutexes(Mutexes: String): Boolean;

to check for a specified mutex, to see which mutexes are created by an application you can use ProcessExplorer.

Most likeley the easiest and best way to handle application mutexes is by adding the 'AppMutex' directive to the Inno Setup script's [Setup] section.

[Setup]
AppMutex=MyMutexName

See the topic Application_considerations Application is running in the article Application_considerations and Inno Setup's help file for more info.

Checking for a Class Name

It is possible to use

function FindWindowByClassName(const ClassName: String): Longint; 

and get window handle if found. It is possible to use this handle to send window messages.

Checking for a Window Name

Instaed of class it is possible to find a window if an application looking for windowname.

function FindWindowByWindowName(const WindowName: String): Longint;

Checking for a running executable file

You can use PSVince to detect if an executable is currently running.

See also

External links

Personal tools
Ads: