织梦CMS - 轻松建站从此开始!

高速音码输入法

当前位置: 主页 > 输入法编程 >

用api查看任务栏中有多少种输入法

时间:2013-06-21 19:19来源:编辑 作者:高速音码 点击:
'例1:取得目前所有的输入法 Private Declare Function GetKeyboardLayoutList Lib "user32" _ (ByVal nBuff As Long, lpList As Long) As Long Private Declare Function ImmGetDescription Lib "imm32.dll" _ Alias "ImmGetDescriptionA" (ByVal HKL As Lo

'例1:博取眼前所有的输入法
Private Declare Function GetKeyboardLayoutList Lib "user32" _
(ByVal nBuff As Long, lpList As Long) As Long
Private Declare Function ImmGetDescription Lib "imm32.dll" _
Alias "ImmGetDescriptionA" (ByVal HKL As Long, _
ByVal lpsz As String, ByVal uBufLen As Long) As Long
Private Declare Function ImmIsIME Lib "imm32.dll" (ByVal HKL As Long) As Long
Private Declare Function ActivateKeyboardLayout Lib "user32" _
(ByVal HKL As Long, ByVal flags As Long) As Long
Private Declare Function GetKeyboardLayout Lib "user32" _
(ByVal dwLayout As Long) As Long


Private Sub Form_Load()
Dim NoOfKBDLayout As Long, i As Long, j As Long
Dim hKB(24) As Long, BuffLen As Long
Dim Buff As String
Dim RetStr As String
Dim RetCount As Long

Buff = String(255, 0)
hCurKBDLayout = GetKeyboardLayout(0) '博取眼前keyboard layout
NoOfKBDLayout = GetKeyboardLayoutList(25, hKB(0)) '博取所有输入法的hkeys
For i = 1 To NoOfKBDLayout
If ImmIsIME(hKB(i - 1)) = 1 Then '中文输入法
BuffLen = 255
RetCount = ImmGetDescription(hKB(i - 1), Buff, BuffLen)
RetStr = Left(Buff, RetCount)
Combo1.AddItem RetStr
Else
RetStr = "English (American)" '假设我们的win95非Ime 者只有English
Combo1.AddItem RetStr '若有其他者,要去博取keyboardLayout
End If ' Name再去Registry中找其对应的称呼
If hKB(i - 1) = hCurKBDLayout Then
Combo1.Text = RetStr
End If
Next
ActivateKeyboardLayout hCurKBDLayout, 0 '回复本来输入法
End Sub
End Function


输入法 (责任编辑:admin)
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
发布者资料
DerrickBarrow 查看详细资料 发送留言 加为好友 用户等级:注册会员 注册时间:2013-01-06 23:01 最后登录:2014-11-27 11:11
栏目列表
推荐内容