I am writing an onscreen keyboard and would like to redraw my layout as soon as keyboard layout is changed.
Currently I call:
GetKeyboardLayout(GetWindowThreadProcessId(GetForegroundWindow(), NULL));
on every key press to find out if the layout has changed. It does not work if user changes the layout by mouse, until key is pressed.
I would like to know if there is any way to get notified when the keyboard layout of the current foreground window is changed, so I can redraw my layout as soon as the change happens.