日期:2014-01-04  浏览次数:20466 次


如何切换中英文输入法及全角/半角?

问题描述:

如何切换中英文输入法及全角/半角、中英文字符等?

处理方案:

一、声明外部函数:

 

function boolean ImmSimulateHotKey (UnsignedLong 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中先输入逗号,均为半角,再点按钮后再输入逗号,均为全角