锐英源软件
第一信赖

精通

英语

开源

擅长

开发

培训

胸怀四海 

第一信赖

当前位置:锐英源 / 开源技术 / C++平台框架库和混编开源 / TSF输入法指定热键
服务方向
人工智能数据处理
人工智能培训
kaldi数据准备
小语种语音识别
语音识别标注
语音识别系统
语音识别转文字
kaldi开发技术服务
软件开发
运动控制卡上位机
机械加工软件
软件开发培训
Java 安卓移动开发
VC++
C#软件
汇编和破解
驱动开发
联系方式
固话:0371-63888850
手机:138-0381-0136
Q Q:396806883
微信:ryysoft

TSF输入法指定热键


I'm developing a TSF (T ext S ervices F ramework) text service that enables users to write text in a certain language using a character set of another language, i.e. some form of transliteration.
My text service registers itself as a new keyboard layout. When the TSF manager activates my text service, it instantiates a COM server that actually reads the keystrokes on the keyboard and transliterates input into words written in the target language character set.
我正在开发一个TSF文本服务,在使用另一种语言的字符集下,它使用户能够写入文本,即某种形式的音译。
我的文字服务将自己注册为新的键盘布局。当TSF管理器激活我的文本服务时,它实例化一个COM服务器,该服务器实际上读取键盘上的击键,并将输入音译为以目标语言字符集编写的单词。
To make it easier to switch to my keyboard layout, i.e. transliteration mode, I want to assign a hotkey to the keyboard layout that my text service registers. I've tried to diff the registry before and after adding a new keyboard layout, observed the differences, and wrote some code that would make all necessary changes in the registry. However, it just did not work.
为了更容易切换到键盘布局(即音译模式),我想为文本服务注册的键盘布局分配一个热键。在添加新的键盘布局之前和之后,我试图对注册表进行比较,观察它们之间的差异,并编写一些代码来对注册表进行所有必要的更改。但是,它只是没有用。
What I have figured out to do in order to assign a hotkey to my keyboard layout is to write the following values to the registry under:
HKCU\Software\Microsoft\CTF\DirectSwitchHotkeys\00001000
(Note: Don't know why exactly '00001000'. That's just what I observed as I added a keyboard layout from the same Language group under which I register my text service)
为了将热键分配给键盘布局,我想做的就是在注册表下写入以下值:
HKCU \ Software \ Microsoft \ CTF \ DirectSwitchHotkeys \ 00001000
(注意:不知道为什么精确地为'00001000 '。这只是我在注册我的文本服务所在的同一语言组中添加键盘布局时所观察到的结果)

CLSID :                <My_Text_Service_CLSID>
LangID :               <Language_Locale_ID>
Modifiers :             "0000c006"   (no clue what that value means)
PreservedKeyId :   {A8D8C31B-1885-11DE-9158-001EC94E8486} (no clue what that value is)
Profile :                 <GUID_Profile>
VirtualKey :           "00000030" (CTRL + SHIFT + 0)

(Note: All are REG_SZ values)
After writing these values to the registry and registering my text service as well as my COM transliteration server, my installed keyboard layout appears installed in the "Text Services and Input Languages" dialog (Right click Language Bar | Settings | General tab), and my hotkey appears under the Advanced Key Settings tab on the same dialog.
However, when I press the hotkey, CTRL + SHIFT + 0 in my case, of my text-service-installed-layout nothing happens! The weird thing is: if I open the Text Services and Input Languages dialog and press OK without performing any selections/modifications to it, the hotkey works fine afterwards!
(注意:所有都是REG_SZ值)
将这些值写入注册表并注册我的文本服务以及COM音译服务器后,已安装的键盘布局显示为已安装在“文本服务和输入语言”对话框中(右键单击语言栏|设置|常规选项卡),然后我的热键出现在同一对话框的“高级键设置”选项卡下。
但是,当我按热键CTRL + SHIFT + 0(对于我的情况)时,我的文本服务安装布局没有任何反应!奇怪的是:如果我打开“文本服务和输入语言”对话框并按“确定”而不对它进行任何选择/修改,则此热键可以正常工作!
What I need to know is:

  • Is there a documented/common way to assign a hotkey to an existing keyboard layout programmtically?
  • I wonder what is it that pressing that OK button does. I’ve compared the entire registry before and after clicking the button and observed no difference whatsoever. Does it force reloading the settings from the registry? Is there a way I can do so programmtically?

Thank you so much in advance.

我需要知道的是:

  • 是否存在以编程方式将热键分配给现有键盘布局的公开化通用化方法?
  • 我不知道按下“确定”按钮会做什么。在单击按钮之前和之后,我已经比较了整个注册表,没有发现任何区别。是否强制从注册表重新加载设置?有没有办法我可以通过编程方式做到这一点?
提前非常感谢您。


You should use RegisterHotKey() to assign a system wide hot key, rather than prodding about in undocumented areas of the registry.您应该使用RegisterHotKey()来分配系统范围的热键,而不要在注册表的未记录区域中使用。

  • Using RegisterHotKey() will not make the hotkey visible in the "Advanced Key Settings" tab of "Text Services and Input Languages" dialog.
  • Consequently, the user will not be able to modify/disable the keyboard layout hotkey via "Text Services and Input Languages" as he/she would do with any other layout.
  • 使用RegisterHotKey()不会使热键在“文本服务和输入语言”对话框的“高级键设置”选项卡中可见。
  • 因此,用户将无法像使用其他布局一样通过“文本服务和输入语言”来修改/禁用键盘布局热键。

 

友情链接
版权所有 Copyright(c)2004-2021 锐英源软件
公司注册号:410105000449586 豫ICP备08007559号 最佳分辨率 1024*768
地址:郑州大学北校区院(文化路97号院)内