如何用api检查任务栏中有多少种输入法
时间:2006-10-25 23:13 来源:Access开发者 作者:佚名 阅读:次
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
(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%
相关内容
- ·API函数详细解释
- ·Access从剪切版里复制和粘贴数据
- ·Access利用api实现打开/关闭光驱
- ·应用程序开机自动启动(注册表操作技巧
- ·Access VBA 判断网络是否连通的多种办
- ·什么是ADP,了解ADP的优缺点
- ·优秀产品大全--通用票据打印软件(新)
- ·[技巧分享]多条Shell语句执行导致判断
- ·在access中可以调用API函数GetFileInfo
- ·Access API集中营--增加临时使用的字体
- ·API ShellExecute 功能说明及应用示例
- ·在VB中使用API函数(什么是API? )
- ·API实现完美的图片出现效果(转)
- ·API 设置调整系统当前时间
- ·如何检测以及设置键盘状态
- ·不关闭当前数据库COPY当前数据库
最新内容
推荐内容