键盘挂钩无法根据键盘设置工作 [英] Keyboard Hook does not work according Keyboard settings

查看:82
本文介绍了键盘挂钩无法根据键盘设置工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好专家,

我正在尝试使用键盘挂钩监视键盘活动.
它成功运行.

但是如果我要通过Control Panel > Regional settings > Keyboard settings将键盘语言更改为阿拉伯语...

然后键盘语言将为阿拉伯语.

但是Keyboard Hook并没有改变它的价值.
美国键盘返回相同.

因此,请描述我如何根据键盘语言设置进行更改.

Hello Experts,

I am trying to monitor Keyboard activity with the use of Keyboard Hook.
It works successfully.

But if I''m changing my Keyboard Language via Control Panel > Regional settings > Keyboard settings to Arabic...

Then Keyboard Language will be Arabic.

But the Keyboard Hook is not changing its value.
It is returning same for US Keyboard.

So please describe me how can I change according to Keyboard Language settings.

推荐答案

键盘挂钩是低级的.我认为即使在美国布局中,钩子也不会返回美国字符.它返回键码,它们与语言无关.顺便说一句,对于钩子功能来说是没有意义的,因为当前的键盘布局/输入语言不是系统范围的,因此会为每个不同的应用程序分别设置它,如果它高于钩子级别的话. >
如果需要的话,您可能需要当前的键盘布局,您可以随时对其进行检索.

您可以使用以下API获取当前线程的当前键盘布局: http://msdn.microsoft.com/en-us/library/ms646296(v=vs.85).aspx [
The keyboard hook is low-level. I don''t think even in US layout the hook returns US characters. It returns key codes, they are language-independent. By the way, for the hook function is would not make sense, because current keyboard layout / input language is not system-wide, it''s set individually for every different application, which if above the level of the hook.

If you''re at the point you may need the current keyboard layout you can always retrieve it.

You can get current keyboard layout for a current thread using this API: http://msdn.microsoft.com/en-us/library/ms646296(v=vs.85).aspx[^].

—SA


我知道这是一个旧线程,但是如果您的键盘记录程序有,我现在正在同一个项目上工作,并且在阿拉伯语中也遇到了同样的问题钩住的一系列ASCI字符(如mine)将asci转换成英文字母,再制作一个将asci转换成阿拉伯语(根据键盘布局)并检查当前布局以在它们之间切换,或者跟踪Shift + Alt键,因为它们是默认的阿拉伯语-英语开关
i know this is an old thread , but i am now working on the same project and i had the same problem in arabic , if your keylogger has a list of ASCI characters that is hooked (like mine ) that translate the asci into English letters , make another one that convert the asci into Arabic (according to the keyboard layout) and check for the current layout to switch between them , or you can track the shift+alt keys as they are the default arabic-english switch


这篇关于键盘挂钩无法根据键盘设置工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆