如何自动切换输入法?

xsFeng 2003-11-01 09:14:23
如何自动切换输入法?
...全文
41 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
nofound007 2003-11-01
  • 打赏
  • 举报
回复
直接修改 控件.IMEmode=1
pandengzhe 2003-11-01
  • 打赏
  • 举报
回复
呵呵,在加个识别语种的:
Sub GetEnv()
Dim i As Integer
ReDim strEnv(10 To 10)
For i = 1 To 9
strEnv(i) = "&H" & CStr(i)
Next

For i = 1 To 10
strEnv(i) = funGetEnv(strEnv(i))
Next

End Sub

Public Function funGetEnv(str As String) As String
Dim S As String
S = String(256, Chr(0))
GetLocaleInfo GetSystemDefaultLCID, Val(str), S, Len(S)
funGetEnv = Left(S, InStr(S, Chr(0)) - 1)
End Function
yoki 2003-11-01
  • 打赏
  • 举报
回复
如何个自动法?
pandengzhe 2003-11-01
  • 打赏
  • 举报
回复

Option Explicit

Private Declare Function GetKeyboardLayoutList Lib "user32" (ByVal nBuff As Long, _
lpList As Long) As Long
Private Declare Function GetKeyboardLayoutName Lib "user32" Alias "GetKeyboardLayoutNameA" _
(ByVal pwszKLID As String) As Long
Private Declare Function GetKeyboardLayout Lib "user32" (ByVal dwLayout 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 ActivateKeyboardLayout Lib "user32" (ByVal hkl As Long, ByVal _
flags As Long) As Long

Const IME_CONFIG_GENERAL = 1
Const KLF_REORDER = &H8
Const KLF_ACTIVATE = &H1

Dim la(1 To 16) As Long
Dim ActIme As Long

Private Sub Combo1_Click()
ActIme = la(Combo1.ListIndex + 1)
Debug.Print ActIme
Text1.SetFocus
End Sub

Private Sub Form_Load()
Dim astr As String * 256
Dim bstr As String
Dim x, hMem, i As Long

x = GetKeyboardLayoutList(32, la(1))
Combo1.Clear
If x Then
For i = 1 To x
ImmGetDescription la(i), astr, 256
If InStr(astr, Chr(0)) = 1 Then
bstr = ""
Else
bstr = Left$(astr, InStr(astr, Chr(0)))
End If

If Trim(bstr) = "" Then
Combo1.AddItem "英语(美国)"
Else
Combo1.AddItem bstr
End If
Next i
End If
End Sub

Private Sub Text1_GotFocus()
If Combo1.ListCount > 0 Then
ActivateKeyboardLayout ActIme, 1
End If
End Sub
since1990 2003-11-01
  • 打赏
  • 举报
回复
up
taosihai1only 2003-11-01
  • 打赏
  • 举报
回复
对,楼上的可用且直接
sunnyBelt 2003-11-01
  • 打赏
  • 举报
回复
对,楼上的可用且直接

7,766

社区成员

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

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