function ProcessIdToName(PID:DWORD):string; var hSnapshot:THandle; PE:PROCESSENTRY32; begin Result:=''; hSnapshot:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); pe.dwSize:= sizeof(PROCESSENTRY32); if Process32First(hSnapshot, pe) <> False then begin while (Process32Next(hSnapshot, pe)) do begin if (pe.th32ProcessID = PID) then begin Result:=pe.szExeFile; Break; end; end; end; end;