Autor Beitrag
Regan
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: So 01.03.09 14:42 
Hallo,

mein Titel verrät eigentlich schon alles.
Zur Zeit verwende ich folgende Funktion:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
function ProcessFileName(PID: DWORD): string;
  var Handle: THandle;
begin
  Result:='';
  Handle:=OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, False, PID);
  if Handle <> 0 then
    try
      SetLength(Result, MAX_PATH);
      if GetModuleFileNameEx(Handle, 0, PChar(Result), MAX_PATH) > 0 then
        SetLength(Result, StrLen(PChar(Result)))
      else
        Result := '';
    finally
      CloseHandle(Handle);
    end;
end;

Leider funktioniert die nicht. Ich könnte auch alternativ ein Handle anbieten.
Wie bekomme ich den Pfad sonst noch raus?

MfG
Regan
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 01.03.09 14:50 
Du versuchst mit einem Prozess-Handle eine Modulnamen-Abfrage zu tätigen. Das kann nicht gehen...

Siehe ToolHelp32-API, dort gibt es Funktionen für den Snapshoot.

Ansonsten konnte man glaube auch über GetModuleFilenameEx unter Angabe diverser Parameter das für Fremdprozesse abfragen, wenn man da ein wenig gewühlt hat ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Regan Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: So 01.03.09 14:57 
Eigentlich mache ich das mit der ProzessID!? Hättest du nicht einen Link, wo gezeigt wird, wie das geht?

Edit: Hab ne Lösung gefunden:
www.delphitricks.com...m_window_handle.html