文件名称:【VS2010 C# 代码】实时监听鼠标位置
文件大小:41KB
文件格式:RAR
更新时间:2020-10-08 10:43:53
VS2010 实时监听 鼠标位置
Microsoft Visual Studio 2010做的C#简单的实时监听鼠标位置实例,主要代码: public class Win32Api { [StructLayout(LayoutKind.Sequential)] public class POINT { public int x; public int y; } [StructLayout(LayoutKind.Sequential)] public class MouseHookStruct { public POINT pt; public int hwnd; public int wHitTestCode; public int dwExtraInfo; } public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam); //安装钩子 [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); }
【文件预览】:
demo_mousehook_baidu
----demo_mousehook_baidu()
--------Form1.Designer.cs(2KB)
--------Program.cs(501B)
--------obj()
--------bin()
--------Form1.cs(4KB)
--------demo_mousehook_baidu.csproj(4KB)
--------Form1.resx(6KB)
--------Properties()
----demo_mousehook_baidu.suo(20KB)
----demo_mousehook_baidu.sln(902B)