求救高手 如何在textbox控件中只能使用智能ABC输入法
求救高手 如何在textbox控件中只能使用智能ABC输入法 五笔 和全屏这三种输入法 别的输入法均不让输入 在线等 谢谢
--------------------编程问答--------------------
为什么要这样作?
--------------------编程问答--------------------
Option Explicit
Private Declare Function GetKeyboardLayout Lib "user32 " (ByVal dwLayout As Long) As Long
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 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
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'函数功能:获取当前输入法的名称
'功能描述:
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Function funGetNowIME() As String
Dim lcurhk As Long
Dim strDescription As String * 100
lcurhk = GetKeyboardLayout(0)
If ImmIsIME(lcurhk) <> 1 Then
funGetNowIME = "English(American) "
Else
ImmGetDescription lcurhk, strDescription, 100
funGetNowIME = TrimNull(strDescription)
End If
End Function
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'函数功能:
'功能描述:
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Public Function TrimNull(ByVal StrIn As String) As String
Dim nul As Long
nul = InStr(StrIn, vbNullChar)
Select Case nul
Case Is > 1
TrimNull = Left(StrIn, nul - 1)
Case 1
TrimNull = " "
Case 0
TrimNull = Trim(StrIn)
End Select
End Function
Private Sub Text1_GotFocus()
If InStr(1, funGetNowIME, "ABC", vbTextCompare) <> 0 Then
Text1.Locked = True '是智能ABC,禁止文本框输入
Else
Text1.Locked = False '不是智能ABC,开启文本框输入
End If
End Sub
--------------------编程问答--------------------
你这个要求好奇怪
--------------------编程问答--------------------
你的软件我肯定不会去用,因为你的输入法我都不会去用它,因为过时了,不符合我现在的输入习惯
--------------------编程问答--------------------
用一个成语形容比较贴切,“画蛇添足”
补充:VB , 控件