1

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 ?

MajesticRa
  • 13,032
  • 11
  • 58
  • 74
jacob
  • 1,337
  • 1
  • 25
  • 50

1 Answers1

2

Doesn't GetKeyboardLayout of WinApi do what you want?

MajesticRa
  • 13,032
  • 11
  • 58
  • 74