![]() |
Prozessinfos
Hallo zusammen,
ich sehe vor lauter Bäumen den Wald nicht mehr. Ich will zu einem Prozess z.B. "calc.exe" den Pfad ermitteln, wo diese Datei liegt. Ich habe mich dazu mal auf ![]() Müsste theoretisch erst die ProzessID ermitteln und mir dann wie hier ![]() die Variable ImageName ausgeben. Geht das nicht irgendwie in einem Zweizeiler? Das Programm soll so klein wie möglich werden. Danke für jede Hilfe! Gruß silent |
Re: Prozessinfos
Zitat:
Code:
uses TlHelp32,PsAPI
function Execheck(exename:string): string; var aSnapshotHandle: THandle; ContinueLoop: BOOL; aProcessEntry32: TProcessEntry32; handle : thandle; begin aSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); aProcessEntry32.dwSize := Sizeof(aProcessEntry32); result := ''; ContinueLoop := Process32First(aSnapshotHandle, aProcessEntry32); handle := 0; while integer(ContinueLoop) <> 0 do begin if (Exename = aProcessEntry32.szExeFile) then begin Handle := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, False, aProcessEntry32.th32ProcessID); if Handle <> 0 then begin SetLength(Result, MAX_PATH); if GetModuleFileNameEx(Handle, 0, PChar(Result), MAX_PATH) > 0 then SetLength(Result, StrLen(PChar(Result))) else Result := ''; CloseHandle(Handle); end; end; ContinueLoop := Process32Next(aSnapshotHandle, aProcessEntry32); end; CloseHandle(aSnapshotHandle); end; |
Re: Prozessinfos
Auch wenns kein Zweilzeiler ist, DANKE!
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:40 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz