Microsoft Visual Studio 2010做的C#简单的鼠标钩子应用实例实例,实现实时监控鼠标位置(需要编译后,在Release文件夹那里运行)主要代码: public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam); //定义钩子句柄 public static int m_iHock = 0; //定义钩子类型 public const int WH_MOUSE_LL = 14; public HookProc HookProcVar; //安装钩子 [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId); //卸载钩子 [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] public static extern bool UnhookWindowsHookEx(int idHook); //调用下一个钩子 [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] public static extern int CallNextHookEx(int idHook, int nCode, IntPtr wParam, IntPtr lParam); [StructLayout(LayoutKind.Sequential)]
- 1
- 粉丝: 38
- 资源: 131
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助