数据库

本类阅读TOP10

·SQL语句导入导出大全
·SQL Server日期计算
·SQL语句导入导出大全
·SQL to Excel 的应用
·Oracle中password file的作用及说明
·MS SQLServer OLEDB分布式事务无法启动的一般解决方案
·sqlserver2000数据库置疑的解决方法
·一个比较实用的大数据量分页存储过程
·如何在正运行 SQL Server 7.0 的服务器之间传输登录和密码
·SQL中两台服务器间使用连接服务器

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
如何在程序中自动控制切换中英文输入法?

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

声明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"

定义变量:

constant int IME_THotKey_IME_NonIME_Toggle=112

ulong hklCurrent

ulong hnd

切换到英文输入法:

hklCurrent=GetKeyboardLayout(0)

if ImmIsIME(hklCurrent) then

   hnd=Handle(parent)

   ImmSimulateHotKey(hnd,IME_THotKey_IME_NonIME_Toggle)

end if

切换到中文输入法:

hklCurrent=GetKeyboardLayout(0)

if not ImmIsIME(hklCurrent) then

  hnd=Handle(parent)

  ImmSimulateHotKey(hnd,IME_THotKey_IME_NonIME_Toggle)

end if

可根据需要,触发两段不同的脚本以达到动态切换中英文输入法的目的


相关文章

相关软件