tôi cần để có được đường dẫn đầy đủ từ một PID, tôi kiểm tra câu hỏi này C++ Windows - How to get process path from its PIDlấy đường dẫn đầy đủ từ một PID sử dụng delphi
và tôi đã viết mã này
function GetFullPathFromPID(PID: DWORD): string;
var
hProcess: THandle;
ModName : Array[0..MAX_PATH + 1] of Char;
begin
Result:='';
hProcess := OpenProcess(PROCESS_ALL_ACCESS,False, PID);
try
if hProcess <> 0 then
if GetModuleFileName(hProcess, ModName, Sizeof(ModName))<>0 then
Result:=ModName
else
ShowMessage(SysErrorMessage(GetLastError));
finally
CloseHandle(hProcess);
end;
end;
nhưng luôn luôn trở lại thông điệp này
module cụ thể không thể tìm thấy
cách tôi có thể trả lại đường dẫn đầy đủ từ một pid?