原创
如何切换中英文输入法及全角/半角?
问题描述:
如何切换中英文输入法及全角/半角、中英文字符等?
解决方案:
一、声明外部函数:
function boolean ImmSimulateHotKey (Unsi
gnedLong hWnd,UnsignedLong dwHotKeyID) library "IMM32.dll"function unsignedlong GetKeyboardLayout (unsignedlong wLayout)library "user32.dll"
function boolean ImmIsIME(unsignedLong hklKeyboardLayout)library "IMM32.DLL"
二、在一个按钮里写:
long ll_hwnd
ll_hwnd = handle(sle_1)
If not ImmIsIME(GetKeyboardLayout(0)) Then
ImmSimulateHotKey(ll_hwnd,16)
End If
ImmSimulateHotKey(ll_hwnd,17)
三、测试:运行后在TEXT中先输入逗号,均为半角,再点按钮后再输入逗号,均为全角