Hab mal schnell den Code rausgesucht den ich in meinem X-Spy verwend und bissi angepasst...
Delphi-Quellcode:
function GetWindowModule(Window: HWND): String;
var
dwProcessID : DWord;
Process : hProcess;
Module : hModule;
Path : array [0..MAX_PATH] of Char;
begin
GetWindowThreadProcessID(Window, @dwProcessID);
Module := GetClassLong(Window, GCL_HMODULE);
if (Module = 0) and (GetLastError <> 0) then
Result := '(Unavailable)';
else
begin
Process := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, False,
dwProcessID);
if Process <> 0 then
begin
if GetModuleFileNameEx(Process, Module, Path, MAX_PATH) > 0 then
begin
GetLongPathName(Path, Path, MAX_PATH);
Result := String(Path)
end
else
Result := '(Unavailable)';
CloseHandle(Process);
end
else
Result := '(Unavailable)';
end;
end;
@w3seek: jain.. es ist ein Module-
Handle.. das
PSDK sagt dazu:
Zitat von
PSDK:
HMODULE:
Handle to a module. The value is the base address of the module.