Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#4

Re: Pfad zur Exe von hProcess

  Alt 3. Jan 2007, 12:44
Habe diese Funktion aus einer anderen aus der DP abgeleitet:

Delphi-Quellcode:
function GetProcessExename(hProcess: THandle): String;
var hProcSnap: THandle;
    pe32: TProcessEntry32;
begin
  hProcSnap := CreateToolHelp32SnapShot(TH32CS_SNAPPROCESS, 0);
  if hProcSnap <> INVALID_HANDLE_VALUE then
  begin
    pe32.dwSize := SizeOf(TProcessEntry32);
    if Process32First(hProcSnap, pe32) = true then
    begin
      while Process32Next(hProcSnap, pe32) = true do
      begin
        if pe32.th32ProcessID = hProcess then
        begin
         Result := pe32.szExeFile;
         exit;
        end;
      end;
    end;
    CloseHandle(hProcSnap);
  end;
end;
Habe jetzt mal TModuleEntry32 genommen statt TProcessEntry32... Aber da bekomme ich nix zurück...

Die ID bekomm ich so:

GetWindowThreadProcessId(wnd,hProcess); Aber wie gesagt... Es funktioniert noch nicht so wies soll

Gruß
Neutral General
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat