如何切换中英文输入法及全角/半角?
问题描述:
如何切换中英文输入法及全角/半角、中英文字符等?
解决方案:
一、声明外部函数:
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中先输入逗号,均为半角,再点按钮后再输入逗号,均为全角
