在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
当C#窗口上有其它控件时,窗口本身检测不到消息。 1 protected override void WndProc(ref Message m) 2 { 3 switch (m.Msg) 4 { 5 case WM_MOUSEMOVE: 6 Debug.Write(string.Format("CurrentDate:{0}", DateTime.Now) + Environment.NewLine); 7 break; 8 } 9 base.WndProc(ref m); 10 } 2、使用PreFilterMessage 1 public partial class Form1 : Form, IMessageFilter 2 { 3 //构造函数里增加 4 public Form1() 5 { 6 InitializeComponent(); 7 Application.AddMessageFilter(this); 8 9 } 10 public bool PreFilterMessage(ref Message msg) 11 { 12 const int WM_MOUSEMOVE = 0x200; 13 if (msg.Msg == WM_MOUSEMOVE) 14 { 15 TestPopUp(); 16 } 17 return false; 18 } 19 }
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论