Re: GetWinFileName
- From: battles <battles@xxxxxxxxxxxxxx>
- Date: Thu, 8 May 2008 13:40:09 -0700 (PDT)
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;
.
- Follow-Ups:
- Re: GetWinFileName
- From: Geoffrey Summerhayes
- Re: GetWinFileName
- References:
- GetWinFileName
- From: battles
- Re: GetWinFileName
- From: Geoffrey Summerhayes
- Re: GetWinFileName
- From: battles
- Re: GetWinFileName
- From: Geoffrey Summerhayes
- GetWinFileName
- Prev by Date: Re: How to represent the letter phi
- Next by Date: Re: GetWinFileName
- Previous by thread: Re: GetWinFileName
- Next by thread: Re: GetWinFileName
- Index(es):