ENG:
I would like to do the following:
- As soon as the program starts to remember the current keyboard,
- Set the keyboard as desired (for example, Serbian Cyrillic),
- Before exiting the program, return the memorized keyboard.
I hope the post is understandable, since I translated it using Google

It seems to me, this is possible using WIN API functions in C lang level:
- SystemParametersInfo() with SPI_GETDEFAULTINPUTLANG/SPI_SETDEFAULTINPUTLANG parameter - for get/set default keyboard layout in system,
- ActivateKeyboardLayout() - set keyboard layout only for current process or thread.
I have not tried it yet.