上传者: xiaobingge2018
|
上传时间: 2021-11-09 19:13:27
|
文件大小: 199KB
|
文件类型: -
模拟鼠标和键盘
注意:不支持Windows 8 / 8.1。
Interceptor是Windows键盘驱动程序的包装器(包装http://oblita.com/Interception)。
使用驱动程序,Interceptor可以模拟按键和鼠标点击...
使用DirectX的游戏,通常不接受使用SendInput()的击键
Windows的受保护区域,如Windows登录屏幕或UAC调暗屏幕
任何应用程序
因为驱动程序模拟击键和鼠标单击,所以目标窗口必须处于活动状态(即,在发送击键和鼠标点击时,不能在另一个窗口上执行多任务)。
如何使用
下载并构建此项目并在项目中引用其DLL。
下载'interception.dll',这是一个由驱动程序作者编写的独立库。将它放在与可执行文件相同的目录中。这是必需的。
从作者的网页下载并安装“install-interception.exe”。安装后重新启动计算机。
在您的代码中,要加载驱动程序,请调用(阅读下面的代码注释;您必须设置过滤模式以捕获按键事件或发送按键操作!):
Input input = new Input();
// Be sure to set your keyboard filter to be able to capture key presses and simulate key presses
// KeyboardFilterMode.All captures all events; 'Down' only captures presses for non-special keys; 'Up' only captures releases for non-special keys; 'E0' and 'E1' capture presses/releases for special keys
input.KeyboardFilterMode = KeyboardFilterMode.All;
// You can set a MouseFilterMode as well, but you don't need to set a MouseFilterMode to simulate mouse clicks
// Finally, load the driver
input.Load();
做你的东西。
input.MoveMouseTo(5, 5); // Please note this doesn't use the driver to move the mouse; it uses System.Windows.Forms.Cursor.Position
input.MoveMouseBy(25, 25); // Same as above ^
input.SendLeftClick();
input.KeyDelay = 1; // See below for explanation; not necessary in non-game apps
input.SendKeys(Keys.Enter); // Presses the ENTER key down and then up (this constitutes a key press)
// Or you can do the same thing above using these two lines of code
input.SendKeys(Keys.Enter, KeyState.Down);
Thread.Sleep(1); // For use in games, be sure to sleep the thread so the game can capture all events. A lagging game cannot process input quickly, and you so you may have to adjust this to as much as 40 millisecond delay. Outside of a game, a delay of even 0 milliseconds can work (instant key presses).
input.SendKeys(Keys.Enter, KeyState.Up);
input.SendText("hello, I am typing!");
/* All these following characters / numbers / symbols work */
input.SendText("abcdefghijklmnopqrstuvw