重写WndProc方法来处理 Windows 消息
2014-02-20 14:44
302 查看
处理 Windows 消息。 在开发winForm时,常常要处理Windows消息,可以重写WndProc来实现。常见代码如下: using System; using System.Drawing; using System.Windows.Forms; namespace csTempWindowsApplication1 { public class Form1 : System.Windows.Forms.Form { // Constant value was found in the "windows.h" header file. private const int WM_LBUTTONDBLCLK== 0x203;//双击左键 [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] protected override void WndProc(ref Message m) { // Listen for operating system messages. switch (m.Msg) { // The WM_ACTIVATEAPP message occurs when the application // becomes the active application or becomes inactive. case WM_LBUTTONDBLCLK: MessageBox.Show("双击了左键"); break; } base.WndProc(ref m); } } }
相关文章推荐
- C# 重写WndProc 拦截 发送 系统消息 + windows消息常量值(1)
- .NET 处理windows消息中获得LParam中XY坐标的两种方法
- C# 重写WndProc 拦截 发送 系统消息 + windows消息常量值(1)--windows消息大全
- C# 重写WndProc 拦截 发送 系统消息 + windows消息常量值(2)
- C# 重写WndProc 拦截 发送 系统消息 + windows消息常量值(2)
- 【转】C# 重写WndProc 拦截 发送 系统消息 + windows消息常量值(1)
- (MFC入门)创建一个windows消息处理函数
- Android编程开发之seekBar采用handler消息处理操作的方法
- 当电脑进入windows loading 界面就死机处理方法
- windows消息处理
- 【翻译】Ext JS 4——Ajax和Rest代理处理服务器端一场和消息的方法
- windows 10 应用商店自带qq 消息推送打开方法
- 如何获取Windows消息中的高、低位的方法
- Struts2重写validateXXX方法校验多个处理逻辑
- windows 消息处理过程说明
- Android学习(5)---异步消息处理方法小结
- windows窗口消息内部处理机制
- Windows下LAMP集成环境AppServ虚拟目录配置方法及错误处理
- MySQL忘记密码在Windows/Linux下的处理方法
- 走进windows编程的世界-----消息处理函数(3)