Interceptor 项目常见问题解决方案

Interceptor 项目常见问题解决方案

Interceptor C# wrapper for a Windows keyboard driver. Can simulate keystrokes and mouse clicks in protected areas like the Windows logon screen (and yes, even in games). Wrapping http://oblita.com/Interception Interceptor 项目地址: https://gitcode.com/gh_mirrors/in/Interceptor

项目基础介绍

Interceptor 是一个 C# 封装库,用于 Windows 键盘驱动程序。它能够模拟按键和鼠标点击,即使在受保护的区域如 Windows 登录屏幕(甚至在游戏中)也能正常工作。该项目基于 Interception 驱动程序,提供了更高级的 API 来处理键盘和鼠标事件。

新手使用注意事项及解决方案

1. 项目依赖和环境配置

问题描述:新手在尝试运行项目时,可能会遇到由于缺少依赖库或环境配置不正确导致的编译错误。

解决方案

  1. 下载并安装 Interception 驱动

    • 访问 Interception 官方网站 下载 interception.dllinstall-interception.exe
    • 运行 install-interception.exe 安装驱动,并重启计算机。
  2. 配置项目依赖

    • interception.dll 放置在与你的可执行文件相同的目录下。
    • 在项目中引用 Interceptor 的 DLL 文件。
  3. 检查环境变量

    • 确保你的开发环境已正确配置,包括 .NET 框架和 C# 编译器。

2. 驱动加载失败

问题描述:在尝试加载驱动时,可能会遇到加载失败的问题,导致无法模拟按键或鼠标点击。

解决方案

  1. 检查驱动安装状态

    • 确认 install-interception.exe 已成功运行,并且驱动已正确安装。
    • 如果驱动未正确安装,重新运行安装程序并重启计算机。
  2. 设置正确的过滤模式

    • 在代码中,确保设置了正确的键盘过滤模式(KeyboardFilterMode)和鼠标过滤模式(MouseFilterMode)。
    • 例如,使用 KeyboardFilterMode.All 来捕获所有键盘事件。
    Input input = new Input();
    input.KeyboardFilterMode = KeyboardFilterMode.All;
    input.Load();
    
  3. 检查权限

    • 确保你的应用程序以管理员权限运行,因为驱动加载需要较高的权限。

3. 模拟按键或鼠标点击无效

问题描述:即使驱动加载成功,模拟按键或鼠标点击可能仍然无效,尤其是在受保护的区域或游戏中。

解决方案

  1. 确认目标窗口处于活动状态

    • 模拟按键和鼠标点击时,目标窗口必须处于活动状态。确保在发送按键或点击之前,目标窗口已被激活。
  2. 调整按键延迟

    • 在某些情况下,按键延迟可能需要调整以确保按键被正确识别。
    • 设置 KeyDelay 属性来调整按键之间的延迟时间。
    input.KeyDelay = 1; // 设置按键延迟为1毫秒
    
  3. 调试和日志记录

    • 启用调试日志记录,检查是否有任何错误或警告信息。
    • 根据日志信息调整代码和配置,确保所有步骤都正确执行。

通过以上步骤,新手可以更好地理解和解决在使用 Interceptor 项目时可能遇到的问题。

Interceptor C# wrapper for a Windows keyboard driver. Can simulate keystrokes and mouse clicks in protected areas like the Windows logon screen (and yes, even in games). Wrapping http://oblita.com/Interception Interceptor 项目地址: https://gitcode.com/gh_mirrors/in/Interceptor

模拟鼠标和键盘 注意:不支持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("abcdefghijklmnopqrstuvwxyz"); input.SendText("1234567890"); input.SendText("!@#$%^&*()"); input.SendText("[]\\;',./"); input.SendText("{}|:\"?"); // And finally input.Unload(); 笔记: BadImageFormatException如果您没有为解决方案中的所有项目(包括此项目)使用正确的体系结构(x86或x64),则可能会获得。因此,您可能必须下载此项目的源代码才能将其重建为正确的体系结构。这应该很简单,构建过程应该没有错误。 您必须从http://oblita.com/Interception下载'interception.dll' 。 如果你已经完成了以上所有操作(正确安装了拦截驱动程序,将interception.dll放在你的项目文件夹中),你仍然无法发送击键: 驱动程序有一个限制,即它不能在不接收至少一次击键的情况下发送击键。这是因为驱动程序不知道键盘是哪个设备ID,因此它必须等待接收击键以从击键中推断出设备ID。 总之,在发送击键之前,请始终按键盘一次。点按任意键。然后你可以发送击键。这不适用于接收击键,因为通过接收击键,您当然已经按下了一个键。 MoveMouseTo()和MoveMouseBy()完全忽略键盘驱动程序。它使用System.Windows.Forms.Position来设置和获取游标的位置(它为下面的各个函数调用标准的Win32 API)。 原因是,在探索键盘驱动程序的鼠标移动功能时,我注意到它没有按像素单位移动光标,而是似乎通过加速移动光标。当我想将光标移动到某个位置时,这会不断产生不一致的值。因为Win32游标设置API通常不被游戏等阻止,所以我发现只需调用这些标准API即可,而无需使用驱动程序。请注意,这仅适用于设置光标位置。拦截光标仍然可以正常工作。例如,您可以使用Interceptor反转鼠标的x和y轴。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

史恋姬Quimby

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值