ComponentFactory.Krypton.Docking.PI.SendMessage C# (CSharp) Method

SendMessage() private method

private SendMessage ( IntPtr hWnd, int Msg, uint wParam, uint lParam ) : uint
hWnd System.IntPtr
Msg int
wParam uint
lParam uint
return uint
        internal static extern uint SendMessage(IntPtr hWnd, int Msg, uint wParam, uint lParam);

Usage Example

Example #1
0
        /// <summary>
        /// Processes Windows messages.
        /// </summary>
        /// <param name="m">The Windows Message to process. </param>
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
            case PI.WM_NCLBUTTONDOWN:
            {
                // Perform a hit test to determine which area the mouse press is over at the moment
                uint result = PI.SendMessage(Handle, PI.WM_NCHITTEST, 0, (uint)m.LParam);

                // Only want to override the behaviour of moving the window via the caption bar
                if (result == PI.HITTEST_CAPTION)
                {
                    // Extract screen position of the mouse from the message LPARAM
                    Point screenPos = new Point((short)((uint)m.LParam & 0x0000FFFFU),
                                                (short)(((uint)m.LParam & 0xFFFF0000U) >> 16));

                    // Find the mouse offset relative to the top left of the window
                    Point offset = new Point(screenPos.X - Location.X, screenPos.Y - Location.Y);

                    // Do not intercept message if inside the max/close buttons
                    if (!HitTestMaxButton(offset) && !HitTestCloseButton(offset))
                    {
                        // Capture the mouse until the mouse us is received and gain focus so we look active
                        Capture = true;
                        Activate();

                        // Use event to notify the request to drag the window
                        OnWindowCaptionDragging(new ScreenAndOffsetEventArgs(screenPos, offset));

                        // Eat the message!
                        return;
                    }
                }
            }
            break;

            case PI.WM_KEYDOWN:
                base.WndProc(ref m);
                FloatingMessages?.OnKEYDOWN(ref m);

                return;

            case PI.WM_MOUSEMOVE:
                base.WndProc(ref m);
                FloatingMessages?.OnMOUSEMOVE();

                return;

            case PI.WM_LBUTTONUP:
                base.WndProc(ref m);
                FloatingMessages?.OnLBUTTONUP();

                return;
            }

            base.WndProc(ref m);
        }