SetMenu() private method

private SetMenu ( HandleRef hWnd, HandleRef hMenu ) : bool
hWnd HandleRef
hMenu HandleRef
return bool
        private void OnRibbonMdiChildActivate(object sender, EventArgs e)
        {
            // Cast to correct type
            Form topForm = sender as Form;

            // Unhook from watching any previous mdi child
            if (_activeMdiChild != null)
            {
                _activeMdiChild.SizeChanged -= OnRibbonMdiChildSizeChanged;
            }

            _activeMdiChild = topForm.ActiveMdiChild;

            // Start watching any new mdi child
            if (_activeMdiChild != null)
            {
                _activeMdiChild.SizeChanged += OnRibbonMdiChildSizeChanged;
            }

            // Update the pendant buttons with reference to new child
            _buttonSpecClose.MdiChild   = _activeMdiChild;
            _buttonSpecRestore.MdiChild = _activeMdiChild;
            _buttonSpecMin.MdiChild     = _activeMdiChild;
            ButtonSpecManager.RecreateButtons();
            PerformNeedPaint(true);

            // We never want the mdi child window to have a system menu, we provide the
            // pendant buttons as part of the ribbon and so replace the need for it.
            PI.SetMenu(new HandleRef(_ribbon, topForm.Handle), NullHandleRef);

            if (_activeMdiChild != null)
            {
                uint windowStyle = PI.GetWindowLong(_activeMdiChild.Handle, PI.GWL_.STYLE);
                windowStyle |= PI.WS_.SYSMENU;
                PI.SetWindowLong(_activeMdiChild.Handle, PI.GWL_.STYLE, windowStyle);
            }
        }