🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.nativeapi.win32
4 messages
4 total messages Started by Man T Tue, 15 Jul 2008 00:46
Check if an app is running
#196
Author: Man T
Date: Tue, 15 Jul 2008 00:46
4 lines
1112 bytes
What API should I call to check if I want to check if an application is 
running?
eg. if want to know if this application is running
c:\temp\updateMyRecord.exe 
Re: Check if an app is running
#197
Author: Remy Lebeau (TeamB)
Date: Tue, 15 Jul 2008 01:09
16 lines
1378 bytes
"Man T" <alanpltse_NOSPAM@yahoo.com.au> wrote in message 
news:487bf345@newsgroups.borland.com...

> What API should I call to check if I want to check if an
> application is running?

There is no single API function for that.  You have to enumerate all running 
processes until you find the filename you are interested in.  Look at 
EnumProcesses(), ie:

    Enumerating All Processes
    http://msdn.microsoft.com/en-us/library/ms682623(VS.85).aspx


Gambit 
Re: Check if an app is running
#123
Author: Raul
Date: Sat, 19 Jul 2008 16:06
34 lines
2227 bytes
Torry's has some Delphi samples for the EnumProcesses (old but should work) 
: http://www.swissdelphicenter.ch/torry/showcode.php?id=616


It looks like you control both executables so another option is to have the 
updateMyRecord create a lock file while it runs and main app check if that 
file exists (e.g. c:\temp\updateMyRecord.lck) - you just need to make sure 
that the file is cleaned up always when your app exits (exceptions 
included).   EnumProcesses is the right way to do it but lock file works 
also for simple things.

Raul



"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:487bf913$1@newsgroups.borland.com...
>
> "Man T" <alanpltse_NOSPAM@yahoo.com.au> wrote in message 
> news:487bf345@newsgroups.borland.com...
>
>> What API should I call to check if I want to check if an
>> application is running?
>
> There is no single API function for that.  You have to enumerate all 
> running processes until you find the filename you are interested in.  Look 
> at EnumProcesses(), ie:
>
>    Enumerating All Processes
>    http://msdn.microsoft.com/en-us/library/ms682623(VS.85).aspx
>
>
> Gambit
> 
Re: Check if an app is running
#128
Author: Gilberto Saraiva
Date: Mon, 21 Jul 2008 12:25
22 lines
1692 bytes
Raul wrote:

> Torry's has some Delphi samples for the EnumProcesses (old but should
> work) : http://www.swissdelphicenter.ch/torry/showcode.php?id=616
> 
> 
> It looks like you control both executables so another option is to
> have the updateMyRecord create a lock file while it runs and main app
> check if that file exists (e.g. c:\temp\updateMyRecord.lck) - you
> just need to make sure that the file is cleaned up always when your
> app exits (exceptions included).   EnumProcesses is the right way to
> do it but lock file works also for simple things.
> 
> Raul

A more friendly way is use a semaphore ( CreateMutex ) if you can code
on both apps.

-- 
[]'s
Gilberto Saraiva
http://gsaraiva.projects.pro.br/
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads