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

类别:数据库 点击:0 评论:0 推荐:

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

问题描述:

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

解决方案:

一、声明外部函数:

 

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

本文地址:http://com.8s8s.com/it/it19520.htm