Einzelnen Beitrag anzeigen

Benutzerbild von diabox
diabox

Registriert seit: 13. Sep 2006
61 Beiträge
 
Delphi 2010 Professional
 
#6

AW: Benachrichtigung wenn Prozess gestartet wurde

  Alt 2. Jun 2012, 18:30
So ähnlich sieht das bei mir auch aus:

Delphi-Quellcode:
function IsProcessRunning(const FileName: string): Cardinal;
var
  hSnapshot : Cardinal;
  EntryParentProc: TProcessEntry32;
begin
  Result := 0;
  hSnapshot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  if hSnapshot = INVALID_HANDLE_VALUE then
    exit;
  try
    EntryParentProc.dwSize := SizeOf(EntryParentProc);
    if Process32First(hSnapshot, EntryParentProc) then
      repeat
        if FileName = EntryParentProc.szExeFile then
          begin
            Result := EntryParentProc.th32ProcessID;
            break;
          end;
      until not Process32Next(hSnapshot, EntryParentProc);
  finally
    CloseHandle(hSnapshot);
  end;
end;
Zum Thema WMI "EventWatching", "Win32_ProcessStartTrace": Rein Interesse halber: Hat damit schon mal jemand gearbeitet und hat Tipps/Code-Schnipsel/Erfahrungen, die er teilen kann?
Wer zweifelt, detoniert nicht!'
Dieter Nuhr
  Mit Zitat antworten Zitat