Ver Mensaje Individual
  #2  
Antiguo 21-09-2015
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola deliriun.

Proba de este modo,
Código Delphi [-]
uses tlhelp32;

function IsAppRunning(const ExeFileName: string): Boolean;
var
  Entry: PROCESSENTRY32;
  hSnapShot: THandle;
begin
  hSnapShot:= CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  Entry.dwSize:= SizeOf(PROCESSENTRY32);

  Result:= False;
  if Process32First(hSnapShot, Entry) then
    while Process32Next(hSnapShot, Entry) and not Result do
      if Entry.szExeFile = ExeFileName then
        Result:= True;
  CloseHandle(hSnapSHot);
end;

Ejemplo de uso:
Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
begin
  if IsAppRunning('notepad.exe') then
    ShowMessage('Se está ejecutando')
  else
    ShowMessage('No se está ejecutando');
end;

Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita