开发者

How to simulate unicode text entry to a form

I have wrote an application that user can register custom global hotkeys. And when these hotkeys pressed they send given text to active form. I am using InputSimulator libray to do this. But when I tried to make this app write text that includes unicode characters (开发者_如何学JAVAFor example: "Ə" in Azerbaijani alphabet) it writes "?" instead. I replaced this char with "\u0259" and other hex codes for this Charachter (And others like "Ü","Ö","Ğ","Ş","Ç"). But nothing changed. I cant fint other libraries support unicode to do this simulation process.

I'm using WindowsForms. I hope you will help me. Thanks!


It might be an issue with the font you are using on the form; make sure it is a unicode font (e.g. Arial Unicode MS).


I had a look at the internals of the library, and the kernel of the problem should lie in the function InputBuilder.AddCharacter, where characters are translated to WM_KEYUP/WM_KEYDOWN messages; however, it seems to do its work nicely according to the documentation of SendInput and of the KEYBDINPUT structure.

My suspect is that, being wScan a WORD parameter, it cannot support Unicode characters outside the BMP, but this wouldn't explain why your character (that should definitely lie inside it) isn't inserted correctly.

Another suspect is that the target application doesn't process correctly those "special" WM_KEYUP/WM_KEYDOWN (that have as wParam VK_PACKET and are translated in a WM_CHAR with black magic); do you have that problem with every application?


A solution is posted here: http://inputsimulator.codeplex.com/discussions/214858

The dev said he "should be releasing soon" in November... I'm currently looking into editing the .dll myself. Looks like only 2 lines of changes. I'll post again if I figure out how.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜