protected override void WndProc(ref Message m) { try { if (m.Msg == NativeMethods.WM_MOUSEACTIVATE) { Crownwood.Magic.Controls.TabPage selectedTab = TabController.SelectedTab; if (selectedTab != null) { Rectangle tabClientRectangle = selectedTab.RectangleToScreen(selectedTab.ClientRectangle); if (tabClientRectangle.Contains(MousePosition)) { InterfaceControl interfaceControl = TabController.SelectedTab.Tag as InterfaceControl; if (interfaceControl != null && interfaceControl.Info != null) { if (interfaceControl.Info.Protocol == ProtocolType.RDP) { interfaceControl.Protocol.Focus(); return; // Do not pass to base class } } } } } } catch (Exception ex) { Runtime.MessageCollector.AddExceptionMessage(message: "UI.Window.Connection.WndProc() failed.", ex: ex, logOnly: true); } base.WndProc(ref m); }