In Delphi 7 IDE opening a form which inherits from THYVisualPlugin causes the exception
“Cannot focus a disabled or invisible window” to be displayed.
In Windows7 this message can be acknowledged, closed and you can continue to work.
In Windows10 this message can be acknowledged, but is redisplayed immediately meaning you cannot proceed in Delphi, the IDE needs to be forced closed.
Attached it the stack trace. The exception is caused by the following.
function THYVisualPlugin.SetFocusedControl(Control: TWinControl): Boolean;
begin
Result := True;
if ActiveControl <> Control then begin
Result := inherited SetFocusedControl(Control);
if not (csDesigning in ComponentState) then begin // added
if ActiveControl <> nil then
SendMessage(ParentWindow, WM_FOCUSOUTOFHOST, 0, 0);
Control.SetFocus;
end; //added
end;
end;