function GetProcessfilename(hand:thandle):string;<br>var<br> aThreadID: DWORD;<br> aProcessID:dword;<br> aProcHandle: DWORD;<br> chararr:array[0..127] of char;<br> xx:hmodule;<br> yy:dword;<br>begin<br> if hand<>0 then<br> begin<br> aThreadID := GetWindowThreadProcessId(hand,@aProcessID);<br><br> if aProcessID<>0 then<br> aProcHandle := OpenProcess(PROCESS_ALL_ACCESS, False, aProcessID);<br><br> if aProcHandle<>0 then<br> begin <br> enumprocessmodules(aprochandle,@xx,sizeof(xx),yy);<br> getmodulebasename(aprochandle,xx,chararr,127); <br> result:=chararr;<br> end;<br> end;<br>end;<br>