Hi Mauro,
Hope this helps.

{----------------------------------------------------------------}
function  IsExeRunningG(FName:String):Boolean;
//  ©2002 EITAN GILBOA  - URL: http://perso.wanadoo.fr/eitang
var  LPPE : TProcessEntry32; H: Thandle;
begin
  result := false;
  h:=CreateToolhelp32Snapshot(TH32CS_SNAPALL ,0);
  Lppe.DwSize:=Sizeof(TProcessEntry32);
  if Process32First(h,lppe)
  then
  Begin;
    if  UpperCase(ExtractFileName(LPPE.szexefile))=UpperCase(FName) then
        result:=true;
    while Process32next(h,lppe) do
    begin
      if  UpperCase(ExtractFileName(LPPE.szexefile))=UpperCase(FName) then
         result:=true;
    end;
  End;
  Closehandle(h);
end;  {IsExeRunning}
{----------------------------------------------------------------}

Cheers,
Charlie




----- Original Message ----- 
From: "mauro russo" <[email protected]>
To: "delphi-en" <[email protected]>
Sent: Saturday, February 28, 2009 12:17 PM
Subject: [delphi-en] Process run check


Dear,

how to check if an .exe is in execution?

In practice I would like to be sure that, if a my application A1 faults
and is closed, it is automatically restarted.
I thought to use a secondary very simple deamon application A2 which
checks if A1 is in execution and, if not, launches it by ShelExecute.
Moreover A1 does the same with A2.

Really I would like to use a S.O. resource to make A1 and A2 periodically
"speaking" each other. So, if A1 is running, but hanging, A2 can choose to
Terminate it and restart it.

I believe there is some simplier way to obtain my goal, but I am not expert
about windows API.

Some help?

Regards,
Mauro.

  ----------

Questa email è stata verificata dal sistema centralizzato antivirus della 
UniPlan Software


[Non-text portions of this message have been removed]



------------------------------------

-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [email protected]! Groups Links



Reply via email to