简体   繁体   English

Windows 10是否具有用于LowLevelHooksTimeout的注册表项

[英]Does Windows 10 have a registry entry for LowLevelHooksTimeout

I'm trying to find a workaround for an issue I'm having when debugging C# in Visual Studio 2015. When the application is debugging it will cause the mouse cursor to severely lag when a breakpoint is hit. 我正在尝试找到在Visual Studio 2015中调试C#时遇到的问题的解决方法。当应用程序进行调试时,当遇到断点时,它将导致鼠标光标严重滞后。 This is because the application registers hooks for the mouse and keyboard. 这是因为应用程序注册了鼠标和键盘的挂钩。 When a breakpoint is hit the hooks are waiting for input but they won't receive any until the timeout is reached (~5 seconds). 当遇到断点时,挂钩将等待输入,但是直到达到超时(〜5秒),它们才会收到输入。

Therefore, I found some solutions online, but nothing that would be relatively straightforward to implement without reworking the hooks. 因此,我在网上找到了一些解决方案,但是如果不重新设计钩子,就无法实现相对简单的解决方案。 I tried adding a registry entry for LowLevelHooksTimeout to see if I could get Windows to more quickly move on to the next hook event when a breakpoint is hit, but it doesn't seem to make a difference. 我尝试为LowLevelHooksTimeout添加一个注册表项,以查看是否可以在遇到断点时使Windows更快地移至下一个钩子事件,但这似乎没有什么不同。

Alternatively, using raw input might be the only way to go, but will require a bit of work. 另外,使用原始输入可能是唯一的方法,但需要一些工作。 Has anyone run into this issue and are there solutions readily available by chance. 有没有人遇到这个问题,是否有偶然的解决方案。

https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/f6032ca1-31b8-4ad5-be39-f78dd29952da/hooking-problem-in-windows-7?forum=windowscompatibility https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/f6032ca1-31b8-4ad5-be39-f78dd29952da/hooking-problem-in-windows-7?forum=windowscompatibility

https://security.stackexchange.com/questions/78732/unregistering-keyboard-hooks-by-timeout-expiration https://security.stackexchange.com/questions/78732/unregistering-keyboard-hooks-by-timeout-expiration

I ended going with this open-source code: http://www.codeproject.com/Articles/17123/Using-Raw-Input-from-C-to-handle-multiple-keyboard 我结束了这个开源代码: http : //www.codeproject.com/Articles/17123/Using-Raw-Input-from-C-to-handle-multiple-keyboard

It has the Raw Input API implemented in C#. 它具有用C#实现的Raw Input API。 There's a simple WPF app in there as well that gives device info and such when you press keys (that's what is in the screenshots at the given link). 那里还有一个简单的WPF应用程序,它可以提供设备信息,以及在您按键时提供的信息(这就是给定链接的屏幕快照中的内容)。 I used the underlying code and integrated it into my application. 我使用了基础代码并将其集成到我的应用程序中。 For example: 例如:

if (RawInputHandler == null)
{
    RawInputHandler = RawInput.Instance;

    RawInputHandler.LoggingEvent += RawInputHandler_LoggingEvent;
    RawInputHandler.KeyPressed += RawInputHandler_KeyPressed;
    RawInputHandler.MousePressed += RawInputHandler_MousePressed;
}

Meanwhile, in the Raw Input side of things, I invoke these events whenever I detect a relevant event come down the pipe. 同时,在事物的原始输入端,每当我检测到管道中有相关事件时,便会调用这些事件。 There's a method called ProcessRawInput(Intpr) where I differentiate between mouse, keyboard, etc. This is done via checking the hardware type in the API's buffer header: 有一种称为ProcessRawInput(Intpr)的方法,可在其中区分鼠标,键盘等。这是通过检查API缓冲区头中的硬件类型来完成的:

if (_rawBuffer.header.dwType == DeviceType.RIM_TYPE_MOUSE)
{
    // Do mouse stuff, invoke event
}

It was a pain, but in the end this API solved the debugging horror of using mouse/keyboard hooks. 这很痛苦,但最终该API解决了使用鼠标/键盘挂钩的调试恐惧。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM