var
pos:Tpoint;
namestr:string;
begin
GetCursorPos(pos);
if FindVCLWindow(pos) is TButton then
begin
namestr:=FindVCLWindow(pos).Name;
listbox1.Items.add(namestr);
end;
end;
var
pos:Tpoint;
namestr:string;
begin
GetCursorPos(pos);
namestr:=FindVCLWindow(pos).Name;
listbox1.Items.add(namestr);
end;
如果我只显示TBUTTOND的呢??
如果只显示TButton
var
pos:Tpoint;
namestr:string;
begin
GetCursorPos(pos);
namestr:=FindVCLWindow(pos).Name;
if FindVCLWindow(pos) is TButton then listbox1.Items.add(namestr);//ok了
end;
procedure TFormMain.Timer1Timer(Sender: TObject);
var
p:tpoint;
curwin:longint;
Parwin:longint;
text,textp:array[0..255] of Char;
var start:cardinal;
begin
getcursorpos(p);
curwin:=windowfrompoint(p);
if (listbox1.Handle=curwin) or (Handle=curwin) then exit;
getclassname(curwin,text,255);
parWin:=GetParent(curwin);
getclassname(parWin,textp,255);
Listbox1.Items.Add(inttostr(curwin)+':'+text+' parent:'+inttostr(parWin)+':'+textp);
listbox1.ItemIndex:=listbox1.Count-1;
end;