dashier funzt bei mir
Delphi-Quellcode:
function GetObjectAtCursor: String;
var
Pos: TPoint;
Obj: TObject;
Wnd: THandle;
begin
GetCursorPos(Pos);
if not assigned(FindVCLWindow(Pos)) then begin
Result := 'Unknown Object at Cursor Position';
exit;
end;
Wnd := FindVCLWindow(Pos).Handle;
if Wnd = 0 then begin
Result := 'Unknown Object at Cursor Position';
exit;
end
else begin
obj := FindControl(Wnd) as tobject;
if Obj <> NIL then
Result := Obj.ClassName
else
Result := 'Unknown Object at Cursor Position';
end;
end;
allerdings funktioniert die funktion nur für das gerade aktive fenster