none
Disable mouseDoubleClick on form (WndProc) RRS feed

  • Question

  • I am using the WndProc function to control my custom shaped form.I can move the form perfectly but i dont know how to disable the doubleclick event on the form.My form has a fixed size,.... in this case the doubleClick causing problems.

    here is the WndProc :

    static const int WM_NCHITTEST = 0x84;
    static const int HTCLIENT = 0x1;
    static const int HTCAPTION = 0x2;

        virtual void WndProc(Message% m) override    {
           
            switch(m.Msg)
            {
             
            case WM_NCHITTEST:
                    __super::WndProc(m);
                    if ((int)m.Result == HTCLIENT)
                        m.Result = (IntPtr)HTCAPTION;
                    break;

                default:
                    __super::WndProc(m);
                       break;
            }
           
            return;
        }

    Thursday, February 14, 2008 7:32 PM

Answers

  •  

    Hi Henkerstone,

    I am sure what exactly you want to achieve, but to disable the DoubleClick event on the form, we usually try the something like the following:

    Code Snippet

            const int WM_LBUTTONDBLCLK = 0x0203;//client area

            const int WM_NCLBUTTONDBLCLK = 0x00A3;//non-client area

     

            protected override void WndProc(ref Message m)

            {

                if (m.Msg == WM_LBUTTONDBLCLK)

                    return;

                if (m.Msg == WM_NCLBUTTONDBLCLK)

                    return;

                base.WndProc(ref m);

            }

     

    Hope this helps.
    Best regards.
    Rong-Chun Zhang

    Wednesday, February 20, 2008 5:09 AM