Public Declare Function GetKeyboardLayout Lib "user32" (ByVal dwLayout As Long) As Long
Public Declare Function ImmIsIME Lib "imm32.dll" (ByVal hkl As Long) As Long
Public Declare Function ImmSimulateHotKey Lib "imm32.dll" (ByVal hwnd As Long, ByVal dw As Long) As LongConst IME_CHOTKEY_IME_NONIME_TOGGLE = &H10 hkb = GetKeyboardLayout(0) '取得目前Thread的Keyboard Layout
If ImmIsIME(hkb) = 0 Then  '代表不是中文输入
    ImmSimulateHotKey txtInput(Index).hwnd,IME_CHOTKEY_IME_NONIME_TOGGLE '模拟按Strl-Space
End Ifhkb = GetKeyboardLayout(0) '取得目前Thread的Keyboard Layout
If ImmIsIME(hkb) = 1 Then  '代表是中文输入
    ImmSimulateHotKey txtInput(Index).hwnd, IME_CHOTKEY_IME_NONIME_TOGGLE '模拟按Strl-Space
End If