Re: GetWinFileName



Thanks. Just didn't need this - GetModuleFileNameExA.
Here is what I was able to come up with:

uses PSAPI

function GetWindowExeName(PassedHandle: THandle): String;
var StrngLen: Integer; ProcID: Cardinal; ProcHndl: THandle;
begin
GetWindowThreadProcessID(PassedHandle, @ProcID);
ProcHndl := OpenProcess(PROCESS_QUERY_INFORMATION or
PROCESS_VM_READ, FALSE, ProcID);
SetLength(Result, 250);
StrngLen := GetModuleFileNameEx(ProcHndl, 0, PChar(Result), 250);
SetLength(Result, StrngLen);
end;

procedure TForm1.Button3Click(Sender: TObject);
var TestHandle: THandle;
begin
TestHandle := 1116410;
Memo1.Lines.Add('Name: ' + GetWindowExeName(TestHandle));
end;
.


Quantcast