# Re: 设定输入法

Posted by cww on February 27, 1998 at 00:05:13:

In Reply to: 设定输入法 posted by 阿晴 on February 25, 1998 at 05:54:06:

使用 loadKeyboardLayout()可以改变order，只要第一个参数传
您要使之变成Top的KeyboardlayoutName，第二个参数传KLF_REORDER
便可，例如底下的例子便是

aa = LoadKeyboardLayout("e0060404", KLF_REORDER) '使大易 变top
aa = LoadKeyboardLayout("00000409", KLF_REORDER) '使英文变top
aa = LoadKeyboardLayout("e0010404", KLF_REORDER) '使注音变top
如此，使顺序变成

注音
英文
大易

而如何得知每个输入法的keyboardlayName呢? 则使用
GetKeyboardLayoutname()它会传回Current KeyBoardLayoutName
配合GetKeyboardLayoutList 取得所有install的KeyBoard Handle
再用activateKeyboardlayout()来设定目前的keyboardLayout如下:

dim hkb5(24) as Long
dim kbdLayoutName(24) as string
Dim kln As String
kln = String(8, 0)
LayOutNO = GetKeyboardLayoutList(25, hkb5(0))
For i = 0 To LayOutNO - 1
ActivateKeyboardLayout hkb5(i), 0
res = GetKeyboardLayoutName(kln)
kbdLayoutName(i) = kln
Next i

Follow Ups: