当前位置: 代码迷 >> PB >> 请问怎么判断当前中英文输入法并切换(ctrl+sapce)
  详细解决方案

请问怎么判断当前中英文输入法并切换(ctrl+sapce)

热度:22   发布时间:2016-04-29 08:26:10.0
请教如何判断当前中英文输入法并切换(ctrl+sapce)
我下一一段代码 但是不管用 dll都是有的

①定义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"  
   
  ②脚本:  
  ulong hklCurrent  
  ulong hnd  
   
  //切换到英文输入法  
  hklCurrent=GetKeyboardLayout(0)  
  if ImmIsIME(hklCurrent) then  
  hnd=Handle(parent)  
  ImmSimulateHotKey(hnd,112)  
  end if  
   
  //切换到中文输入法  
  hklCurrent=GetKeyboardLayout(0)  
  if not ImmIsIME(hklCurrent) then  
  hnd=Handle(parent)  
  ImmSimulateHotKey(hnd,112)  
  end if


各位前辈,有没有能用的给发一下啊,感激不尽

------解决方案--------------------
探讨

我又找了一个这次管用了 但是当有多个中文输入法 输入法切换回中文时 不会跳转到上次使用的中文输入法

我的想法是: if 你不想要的输入法(只分中文和英文两种) then ctrl + space
这样就完美了,但是如何在pb中实现 ctrl + space 呢
  相关解决方案