人生有起有落,奋斗吧 官方网站:www.flameschen.com
分类:
2008-01-21 20:37:39
鼠标好办,左右互换:
[DllImport("user32.dll")]
private extern static bool SwapMouseButton(bool fSwap);
隐藏光标
[DllImport("user32.dll")]
static extern bool ShowCursor(bool bShow);
锁定鼠标在某区域
[DllImport("user32.dll")]
static extern bool ClipCursor(ref RECT lpRect);
键盘事件就要用全局HOOK了,可是把SetWindowsHook最后一个参数为0后根本没反应-_-,一查才知道
“You cannot implement global hooks in Microsoft .NET Framework. To install a global hook, a hook must have a native dynamic-link library (DLL) export to inject itself in another process that requires a valid, consistent function to call into. This requires a DLL export, which .NET Framework does not support. Managed code has no concept of a consistent value for a function pointer because these function pointers are proxies that are built dynamically”
这时候就我就选择去CodeProject,终于找到一个篇,把类拿来用用吧 我懒喜欢用别人的成果-_-
完成收工 界面麻就不贴了 反正自己用