Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to detect if a pacticular application is running?

Status
Not open for further replies.

edeaux

Programmer
Mar 7, 2003
16
PH
anybody here knows how to detect an application that is running?
 
hi

If you know the class type of the app you can use FindWindow directly. If not, have a look at the EnumWindows example in thread102-610666.


lou


 
...if you want to detect whether your own app is running from within itself, for example, if you've written a screen saver and need to check whether itself should run or not, use a Mutex. Here's an example, taken from screen saver - this code is put in the DPR file.

var
CmdLine: String;
MutHandle: THandle = 0;

begin
MutHandle := OpenMutex(MUTEX_ALL_ACCESS, False, 'Screen Saver.Boring');
if MutHandle = 0 then
MutHandle := CreateMutex(nil,false,'Screen Saver.Fun')
else Exit;
:


lou

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top