How to simulate Alt + Shift to change the language in Windows (part II)?

The problem (dynamic transition) is solved with ActivateKeyboardLayout , but it still persists when I dynamically create a component in the form (e.g. TEdit). When this component comes into focus, the language changes to the default value. I tried using ActivateKeyboardLayout again after creating the components, but this did not work. Any ideas?

+4
source share
2 answers

you must use "Windows" first, then you can use this method: ActivateKeyboardLayout (EnglishLayoutHandle, KLF_ACTIVATE) you can change "EnglishLayoutHandle" for any language you want

+1
source

Your problem may be similar to this question .

Otherwise, this code does this:

keybd_event(VK_MENU, 0, 0, 0); keybd_event(VK_SHIFT, 0, 0, 0); keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0 ); keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0); 
0
source

Source: https://habr.com/ru/post/1343133/


All Articles