How to convert a message from a WH_KEYBOARD_LL to corespondig unicode char

后端 未结 3 1276
醉梦人生
醉梦人生 2021-01-16 19:29

hello I\'m writing a multilingual app and I\'m using a WH_KEYBOARD_LL hook. I doesn\'t mater why I\'m using the hook, I\'m tried multiple things but this is the

相关标签:
3条回答
  • 2021-01-16 19:41

    May be something like MapVirtualKeyEx or ToUnicodeEx. Anyway, I think a function from the Keyboard Input section of MSDN will contain a proper function (the list of them is short).

    0 讨论(0)
  • 2021-01-16 19:45

    That conversion is complicated. Even simple deadkeys are annoying to handle, and when using an IME gets very ugly.

    Consider intercepting the messages where the input control receives the already converted character. But of course that's much uglier to code.

    The problem is that a normal message hook requires dll injection into the target process, and that dll should not be written in C#. But perhaps there is some other message interception API that works without dll injection.

    0 讨论(0)
  • 2021-01-16 19:55

    ToUnicodeEx(). It doesn't work in practice unless the keyboard layout is simple. The dead keys is what kills you. Michael Kaplan wrote an 11 part blog serial about it but afaict he just gave up without finishing it. See what you can salvage from it but don't get your hopes up. Chinese use an IME, an Input Method Editor. Software, I think it builds up the character by strokes.

    0 讨论(0)
提交回复
热议问题