精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
Currently I am adapting a existent project that simulates text input (just like a software keyboard) and it currently works very well for US keyboards. I want to add support for other languages/keyboard layouts including Chinese.
Currently the project gets keyboard virtual keys from a hook and sends to a selected program via its window. However if I use a Chinese keyboard I do not get the usual candidate list as I type and when using the OSK from Microsoft it results not in Chinese characters but Western characters.
I read about TSF and it seems the way to go for Chinese input. I think I should sent the keys to a text service and TSF will be responsible for the candidate editing and correct character generation. From http://blogs.msdn.com/b/tsfaware/archive/2007/10/05/what-to-do-when-you-push-a-key.aspx i read that
"The answer is that most keyboard related text services only work with a particular keyboard layout, and the text service manages the mapping from virtual key codes to character codes."
I took a read on http://blogs.msdn.com/b/tsfaware, I found a sample project at http://input.foruto.com/IME/Windows/IME_PROGRAMMING/TSF/index.html and of the MSDN samples http://archive.msdn.microsoft.com/tsf/Release/ProjectReleases.aspx?ReleaseId=1755 but I don't have a clear idea on how (or if I can) sent input to TSF via a text service instead of a real keyboard or OSK...
By the way, how does the MS OSK does this? Does it uses also TSF? It works perfectly when using a Chinese keyboard layout.
目前,我正在改编一个现有的项目,该项目可以模拟文本输入(就像软件键盘一样),并且目前在美国键盘上工作得很好。我想添加对其他语言/键盘布局(包括中文)的支持。
当前,该项目从钩子获取键盘虚拟键,并通过其窗口发送到选定的程序。但是,如果我使用中文键盘,则在键入时不会得到通常的候选列表,并且在使用Microsoft的OSK时,它不是中文字符而是西方字符。
我读了有关TSF的文章,这似乎是寻求中文输入的途径。我认为我应该将密钥发送给文本服务,TSF将负责候选者的编辑和正确的字符生成。从 http://blogs.msdn.com/b/tsfaware/archive/2007/10/05/what-to-do-when-you-push-a-key.aspx中我读到了
“ 答案是,大多数与键盘相关的文本服务仅适用于特定的键盘布局,并且该文本服务管理从虚拟键代码到字符代码的 映射。 ”
我在http://blogs.msdn.com/b/tsfaware上进行了阅读,在http://input.foruto.com/IME/Windows/IME_PROGRAMMING/TSF/index.html和MSDN上找到了一个示例项目 样本 http://archive.msdn.microsoft.com/tsf/Release/ProjectReleases.aspx?ReleaseId=1755,但我不清楚如何(或是否可以)通过文本服务将输入发送到TSF真正的键盘或OSK ...
顺便问一下,MS OSK如何做到这一点?它也使用TSF吗?使用中文键盘布局时,它可以完美工作。
I don't think you need to care much about TSF if you're sending applications virtual keys via Windows messages.
As long as the following conditions are met, you're done:
- The application gets the focus while receiving virtual key messages.
- The Chinese input method is activated and in Chinese input mode.如果您要通过Windows消息发送应用程序虚拟密钥,我认为您不需要太在意TSF。
只要满足以下条件,您就可以完成:
-在接收虚拟按键消息时,应用程序将获得焦点。
-中文输入法已激活并处于中文输入模式。