程序中怎么改变textbox文本框输入法

笑里春秋多少泪 2008-03-27 02:10:08
程序中怎么改变textbox文本框输入法?
...全文
83 点赞 收藏 9
写回复
9 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
Sweetbaby722 2008-03-28
学习了。
回复
cbm6666 2008-03-28
Option Explicit
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
Const KLF_REORDER = &H8
Dim i&, IMEcounts&, Buff$, RetStr$, hKB&(24) 'IMEstr$()

Private Sub Form_Load()
Buff = String(255, 0)
IMEcounts = GetKeyboardLayoutList(25, hKB(0)) '取得所有输入法
For i = 1 To IMEcounts
'ReDim Preserve IMEstr(i)
If ImmIsIME(hKB(i - 1)) = 1 Then '中文输入法
Call ImmGetDescription(hKB(i - 1), Buff, 255)
RetStr = Mid(Buff, 1, InStr(Buff, Chr(0)) - 1)
Else
RetStr = "English (American)" '英文输入法
End If
'IMEstr(i) = RetStr
Combo1.AddItem RetStr
Next i
Call ActivateKeyboardLayout(hKB(0), KLF_REORDER)
End Sub

Private Sub Combo1_Click()
Call ActivateKeyboardLayout(hKB(Combo1.ListIndex), KLF_REORDER)
End Sub

'Private Sub Text1_GotFocus()
' Call ActivateKeyboardLayout(hKB(0), KLF_REORDER)
'End Sub

'Private Sub Text2_GotFocus()
' Call ActivateKeyboardLayout(hKB(3), KLF_REORDER)
'End Sub

回复
还是不会弄
回复
qiu5208 2008-03-28
学习
回复
cbm6666 2008-03-27
楼上正解, 呵呵, 你贴还是我贴 ?

回复
tzwsoho 2008-03-27
先用GetKeyboardLayoutList列举输入法的id,然后通过ActivateKeyboardLayout激活需要的输入法,
输入法的名称可以通过ImmGetDescription获取
回复
这个属性点不出来啊,只能在画面属性栏中设置,而且好像就只有中英文啊,我需要变成日文不知道可不可以,我的输入法里面有日文输入法。
回复
tingting1123 2008-03-27
?

IMEMode 属性是这个嘛?
回复
pvgyetg 2008-03-27
有意思
回复
相关推荐
发帖
VB基础类
创建于2007-09-28

7492

社区成员

VB 基础类
申请成为版主
帖子事件
创建了帖子
2008-03-27 02:10
社区公告
暂无公告