var hnd: THandle; begin Handle := Self.Handle; GetClassName(Handle, myClassName, 64); Memo1.Lines.Add(Format('%7d %-64s',[Handle,StrPas(myClassName)])); {now list all the others} While Handle > 0 do begin Handle := GetWindow(Handle, GW_HWNDNEXT); GetClassName(Handle, myClassName, 64); Memo1.Lines.Add( Format('%7d %-64s',[Handle,StrPas(myClassName)])); end; end;
然后用FindWindow/FindWindowEx找到 其BUTTON当时的句柄...
begin
Handle := Self.Handle;
GetClassName(Handle, myClassName, 64);
Memo1.Lines.Add(Format('%7d %-64s',[Handle,StrPas(myClassName)]));
{now list all the others}
While Handle > 0 do
begin
Handle := GetWindow(Handle, GW_HWNDNEXT);
GetClassName(Handle, myClassName, 64);
Memo1.Lines.Add(
Format('%7d %-64s',[Handle,StrPas(myClassName)]));
end;
end;