procedure TForm1.Timer1Timer(Sender: TObject);
var
I: Integer;
S: string;
begin
S := '<没有找到>';
for I := 0 to ComponentCount - 1 do
if (Components[I] is TControl) and
PtInRect(TControl(Components[I]).BoundsRect,
TControl(Components[I]).Parent.ScreenToClient(Mouse.CursorPos)) then
S := Components[I].Name;
Caption := S;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
I: Integer;
S: string;
begin
S := '<没有找到>';
for I := 0 to ComponentCount - 1 do
if (Components[I] is TControl) and
PtInRect(TControl(Components[I]).BoundsRect,
TControl(Components[I]).Parent.ScreenToClient(Mouse.CursorPos)) then
S := Components[I].Name;
Caption := S;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
I: Integer;
S: string;
begin
S := '<没有找到>';
for I := 0 to ComponentCount - 1 do
if (Components[I] is TControl) and
PtInRect(TControl(Components[I]).BoundsRect,
TControl(Components[I]).Parent.ScreenToClient(Mouse.CursorPos)) then
S := Components[I].Name;
Caption := S;
end;
The WindowFromPoint function does not retrieve the handle of a hidden or disabled window, even if the point is within the window. An application should use the ChildWindowFromPoint function for a nonrestrictive search.
procedure TForm1.Timer1Timer(Sender: TObject);
var
I: Integer;
S: string;
vPoint: TPoint;
begin
S := '<没有找到>';
vPoint := ScreenToClient(Mouse.CursorPos);
for I := 0 to ComponentCount - 1 do
if (Components[I] is TControl) and
PtInRect(TControl(Components[I]).BoundsRect, vPoint) then begin
S := Components[I].Name;
Break;
end;
Caption := S;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
I: Integer;
S: string;
vPoint: TPoint;
begin
S := '<没有找到>';
vPoint := ScreenToClient(Mouse.CursorPos);
for I := 0 to ComponentCount - 1 do
if (Components[I] is TControl) and
PtInRect(TControl(Components[I]).BoundsRect, vPoint) then begin
S := Components[I].Name;
Break;
end;
Caption := S;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
I: Integer;
S: string;
vPoint: TPoint;
begin
S := '<没有找到>';
vPoint := ScreenToClient(Mouse.CursorPos);
for I := 0 to ComponentCount - 1 do
if (Components[I] is TControl) and
PtInRect(TControl(Components[I]).BoundsRect, vPoint) then begin
S := Components[I].Name;
Break;
end;
Caption := S;
end;