none
如何抓標題列的 WM_NCLBUTTONUP RRS feed

  • 問題

  •  啥都出現了'就是沒看到 WM_NCLBUTTONUP

    我想要出現 WM_NCLBUTTONUP 後重新排列 Forms

     public const int WM_MBUTTONDBLCLK = 0x209;
            public const int WM_MBUTTONDOWN = 0x207;
            public const int WM_MBUTTONUP = 0x208;
            public const int WM_MENUGETOBJECT = 0x124;
            public const int WM_MENURBUTTONUP = 0x122;
            public const int WM_MOUSEACTIVATE = 0x21;
            public const int WM_MOUSEHOVER = 0x2A1;
            public const int WM_MOUSELEAVE = 0x2A3;
            public const int WM_MOUSEMOVE = 0x200;
            public const int WM_NCHITTEST = 0x84;
            public const int WM_NCLBUTTONDBLCLK = 0xA3;
            public const int WM_NCLBUTTONDOWN = 0xA1;
            public const int WM_NCLBUTTONUP = 0xA2; //0xA2;
    
            public const int WM_NCMBUTTONDBLCLK = 0xA9;
            public const int WM_NCMBUTTONDOWN = 0xA7;
            public const int WM_NCMBUTTONUP = 0xA8;
            public const int WM_NCMOUSEMOVE = 0xA0;
            public const int WM_NCRBUTTONDBLCLK = 0xA6;
            public const int WM_NCRBUTTONDOWN = 0xA4;
            public const int WM_NCRBUTTONUP = 0xA5;
            public const int WM_PARENTNOTIFY = 0x210;
            public const int WM_QUERYDRAGICON = 0x37;
            public const int WM_RBUTTONDBLCLK = 0x206;
            public const int WM_RBUTTONDOWN = 0x204;
            public const int WM_RBUTTONUP = 0x205;
            public const int WM_SETCURSOR = 0x20;
            public const int WM_XBUTTONDBLCLK = 0x20D;
            public const int WM_XBUTTONDOWN = 0x20B;
            public const int WM_XBUTTONUP = 0x20C;
    
            private int NCLButtonUP = WM_NCLBUTTONDOWN + WM_NCHITTEST + WM_NCHITTEST + WM_SETCURSOR + WM_NCMOUSEMOVE;
            public  int NCLButtonUp = 0;
            protected override void WndProc(ref Message m)
            {
                lock (lo1)
                {
                    if (m.Msg == WM_NCLBUTTONDOWN)
                    {
                        NCLButtonUp = 0;
                        Console.WriteLine("===================");
                    }
                    
                    NCLButtonUp += m.Msg;
    
                    if (NCLButtonUp == NCLButtonUP)
                    {
                        Boss.GameBoxState(this, GAMEBoxState.Move);
                        Console.WriteLine(">>>>>>>>>>>>>>>>>>>>>>>>");
                    }
    
                    base.WndProc(ref m);
    
                    printMsg(m.Msg);
                }
            }
    
            private object lo1 = new object();
            private void printMsg(int msg)
            {
                string msg2 = "" + msg;
                switch (msg)
                {
                    case 0x209: msg2 = "WM_MBUTTONDBLCLK"; break;
                    case 0x207: msg2 = "WM_MBUTTONDOWN"; break;
                    case 0x208: msg2 = "WM_MBUTTONUP"; break;
                    case 0x124: msg2 = "WM_MENUGETOBJECT"; break;
                    case 0x122: msg2 = "WM_MENURBUTTONUP"; break;
                    case 0x21: msg2 = "WM_MOUSEACTIVATE"; break;
                    case 0x2A1: msg2 = "WM_MOUSEHOVER"; break;
                    case 0x2A3: msg2 = "WM_MOUSELEAVE"; break;
                    case 0x200: msg2 = "WM_MOUSEMOVE"; break;
                    case 0x84: msg2 = "WM_NCHITTEST"; break;
                    case 0xA3: msg2 = "WM_NCLBUTTONDBLCLK"; break;
                    case 0xA1: msg2 = ">>>>>WM_NCLBUTTONDOWN"; break;
                    case 0xA2: msg2 = "-----WM_NCLBUTTONUP"; break;
    
                    case 0xA9: msg2 = "WM_NCMBUTTONDBLCLK"; break;
                    case 0xA7: msg2 = "WM_NCMBUTTONDOWN"; break;
                    case 0xA8: msg2 = "WM_NCMBUTTONUP"; break;
                    case 0xA0: msg2 = "WM_NCMOUSEMOVE"; break;
                    case 0xA6: msg2 = "WM_NCRBUTTONDBLCLK"; break;
                    case 0xA4: msg2 = "WM_NCRBUTTONDOWN"; break;
                    case 0xA5: msg2 = "WM_NCRBUTTONUP"; break;
                    case 0x210: msg2 = "WM_PARENTNOTIFY"; break;
                    case 0x37: msg2 = "WM_QUERYDRAGICON"; break;
                    case 0x206: msg2 = "WM_RBUTTONDBLCLK"; break;
                    case 0x204: msg2 = "WM_RBUTTONDOWN"; break;
                    case 0x205: msg2 = "WM_RBUTTONUP"; break;
                    case 0x20: msg2 = "WM_SETCURSOR"; break;
                    case 0x20D: msg2 = "WM_XBUTTONDBLCLK"; break;
                    case 0x20B: msg2 = "WM_XBUTTONDOWN"; break;
                    case 0x20C: msg2 = "WM_XBUTTONUP"; break;
                        
                }
                Console.WriteLine("[" + DateTime.Now.Second + "]  " + msg2 + "   ===========> "+NCLButtonUp + "<<==");
            }

    放開滑鼠後'只看到這幾個

    感溫~

    環境win7 64/vs2010

    • 已編輯 ㄚ笠市 2012年5月27日 上午 04:34
    2012年5月27日 上午 04:23

解答

所有回覆