jacob
jacob

Reputation: 1427

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

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 ?

Upvotes: 1

Views: 979

Answers (1)

Dmitry Romanov
Dmitry Romanov

Reputation: 14090

Doesn't GetKeyboardLayout of WinApi do what you want?

Upvotes: 2

Related Questions