如何得知当前打开的输入法是什么

lj77916 2004-12-27 05:48:54
怎样才能知道当前打开的输入法是某个输入法
...全文
194 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
northwolves 2004-12-28
  • 打赏
  • 举报
回复
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()
MsgBox getlayout, vbInformation, "当前输入法"
End Sub

Function getlayout() As String
Dim buff As Long
getlayout = "英文输入法"
buff = GetKeyboardLayout(0) '取得目前的输入法
If ImmIsIME(buff) = 1 Then '中文输入法
getlayout = Space(255)
ImmGetDescription buff, getlayout, Len(getlayout)
End If
End Function

igis 2004-12-28
  • 打赏
  • 举报
回复
Function getlayout() As String
Dim buff As Long
getlayout = "英文输入法"
buff = GetKeyboardLayout(0) '取得目前的输入法


Do While ImmIsIME(buff) <> 1
ActivateKeyboardLayout 1, 1
Loop

End Function
这样一段代码,表示,如果不是英文输入法,则将其切换英文输入法,可是为什么上面那是一个死循环呢??
igis 2004-12-28
  • 打赏
  • 举报
回复
ImmIsIME(buff) = 1 返回值为1时,表示当前输入为中文对吗?如果是,返回值不为1那表示当前输入法为英文??
warlord 2004-12-28
  • 打赏
  • 举报
回复
没的说了,楼上正解.
igis 2004-12-28
  • 打赏
  • 举报
回复
楼主自己不关心??

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧