精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
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:
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()来分配系统范围的热键,而不要在注册表的未记录区域中使用。