Einzelnen Beitrag anzeigen

Koloss

Registriert seit: 21. Jul 2010
74 Beiträge
 
Delphi 2 Desktop
 
#1

IsProcess funktioniert unter Delphi 2010 nicht mehr!

  Alt 21. Jul 2010, 11:25
Bekomme bei rProcess.aExeFile, ein blödsinn Raus!

Unter Delphi 2007 funktioniert es noch! Betriebsystem WinXP!

Delphi-Quellcode:
function IsProcess(ExeName: string): Boolean;
(*
** This routine examines Windows processes currently running to see if a
** certain program is running.
**
** sExe  : The executable name of the program to check.
** Result: True if the program is running, False otherwise.
*)

var
  liI, lSnapShot: Longint;
  rProcess : TProcessEntry32;
begin
  Result := False;
  ExeName := UpperCase(ExeName);
  lSnapShot := CreateToolHelpSnapShot(TH32CS_SNAPPROCESS, 0);
  if lSnapShot <> 0 then begin
    rProcess.iSize := SizeOf(rProcess);
    liI := ProcessFirst(lSnapShot, rProcess);
    while liI <> 0 do begin
      if Pos(ExeName, UpperCase(rProcess.aExeFile)) <> 0 then begin
        Result := True;
        Break;
      end;
      liI := ProcessNext(lSnapShot, rProcess);
    end;
    CloseHandle(lSnapShot);
  end;
end;
Hat wer eine Idee?

Geändert von mkinzler (21. Jul 2010 um 11:26 Uhr) Grund: Delphi-Tag eingefügt
  Mit Zitat antworten Zitat