当前位置: 代码迷 >> PB >> 怎么设置默认输入法
  详细解决方案

怎么设置默认输入法

热度:78   发布时间:2016-04-29 09:14:38.0
如何设置默认输入法
如何设置默认输入法

程序一打开就设定默认的输入法为英文

------解决方案--------------------
好像用API吧.
------解决方案--------------------
这个必须得调用系统API才能实现了,具体的google
------解决方案--------------------
pb 动态切换输入法
http://download.csdn.net/detail/newease/2809694
------解决方案--------------------
需要调用API
//输入法控制
function boolean ImmSimulateHotKey (ULong hWnd, ULong dwHotKeyID) library "IMM32.dll" 
function ulong GetKeyboardLayout(ulong dwLayout) LIBRARY "user32.dll" 
function boolean ImmIsIME(uLong hklKeyboardLayout) library "IMM32.DLL" 

/////
//切换到英文输入法
int IME_THotKey_IME_NonIME_Toggle=112 
ulong hklCurrent 
hklCurrent=GetKeyboardLayout(0) 
if ImmIsIME(hklCurrent) then ImmSimulateHotKey(hnd,IME_THotKey_IME_NonIME_Toggle) 
end if
------解决方案--------------------
可以去这里下载

http://download.csdn.net/detail/yo_yo2005/2415971


------解决方案--------------------
shared变量:
constant long IME_CHOTKEY_IME_NONIME_TOGGLE = 16 //切换中英文输入法
constant long IME_CHOTKEY_SHAPE_TOGGLE = 17 //切换半角和全角
constant long IME_CHOTKEY_SYMBOL_TOGGLE = 18 //切换中文标点和英文标点
constant long IME_CHOTKEY_LAST = 47
外部变量:
function long ImmSimulateHotKey(long h,long hkey) library 'IMM32.dll'
function long GetKeyboardLayout(long h) library 'user32.dll'
function boolean ImmIsIME(long h) library 'IMM32.dll'


public subroutine of_to_chinese (long h);
//转化中文输入法
long lcurrent_ime
lcurrent_ime = getkeyboardlayout(0)
if not immisime(lcurrent_ime) then
ImmSimulateHotKey(h, IME_CHOTKEY_IME_NONIME_TOGGLE)// hkey)
end if
end subroutine

public subroutine of_to_english (long h);
//转换英文输入法
long lcurrent_ime
lcurrent_ime = getkeyboardlayout(0)
if immisime(lcurrent_ime) then
ImmSimulateHotKey(h, IME_CHOTKEY_IME_NONIME_TOGGLE)
end if
end subroutine

public function boolean of_is_chinese (long h);
//确认输入法类型
long lcurrent_ime
lcurrent_ime = getkeyboardlayout(0)
return immisime(lcurrent_ime)

end function

public subroutine f_tochinese (window mywin);
////把输入法调成中文
if of_is_chinese( handle(mywin)) then return
of_to_chinese( handle(mywin))
end subroutine

public subroutine f_toenglish (window mywin);
////把输入法调成英文
if not of_is_chinese( handle(mywin)) then return
of_to_english( handle(mywin))

end subroutine
 
------解决方案--------------------
都是VB 高手啊!!
------解决方案--------------------
探讨
都是VB 高手啊!!
  相关解决方案