Autor Beitrag
Jan11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 62



BeitragVerfasst: Mo 09.01.06 18:36 
hallo,
ich möchte feststellen können ob ein prozess läuft oder nich? also das das programm was ich schreibe da irgendwo nachguckt und mir dann ne meldung gibt ob er läuft oder nich. wie geht das mit delphi?
MfG Jan


Moderiert von user profile iconChristian S.: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Mo 09.01.2006 um 20:03
SAiBOT
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 323
Erhaltene Danke: 6

XP SP2; 7
D7; D2009
BeitragVerfasst: Mo 09.01.06 20:25 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
uses TlHelp32;

function IsExeRunning(const AExeName: string): boolean;
var
  h: THandle;
  p: TProcessEntry32;
begin
  Result := False;

  p.dwSize := SizeOf(p);
  h := CreateToolHelp32Snapshot(TH32CS_SnapProcess, 0);
  try
    Process32First(h, p);
    repeat
      Result := AnsiUpperCase(AExeName) = AnsiUpperCase(p.szExeFile);
    until Result or (not Process32Next(h, p));
  finally
    CloseHandle(h);
  end;
end;


bsp:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
if IsExeRunning('Notepad.exe') then
   ShowMessage('Notepad läuft')
 else
   ShowMessage('Notepad läuft nicht');