get the current selected language of the language bar in windows 7

空扰寡人 提交于 2019-12-25 00:44:13

问题


I am writing a key logger in windows 7 ( using SetWindowsHookEx ) and I need to know the correct keyboardLayout for the key being pressed. I tried getting the keyboardLayout from the ForegroundWindow and this works fine in most cases but in Internet Explorer 9 it doesn't work as expected (it returns the wrong layout ). I thought about getting the layout from the language bar ( because it shows the language of the window that is currently being typed on ) but I don't know how to retrieve this data. Maybe there is a registry key with this data or I can ask the language bar window for its text. Any ideas ?


回答1:


Doesn't GetKeyboardLayout of WinApi do what you want?



来源:https://stackoverflow.com/questions/6135776/get-the-current-selected-language-of-the-language-bar-in-windows-7

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!