通过注册表方式启动和关闭手写输入法(方法适合各种应用)

需求:window系统下,点击输入窗口时,需要自动弹出手写输入法。点击除输入窗口外位置时,需要关闭手写输入法。

实现:

一、安装手写输入法插件(我选用的是搜狗输入法)

二、创建一个添加注册表文件:hinput.reg。然后编辑如下内容

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Handinput]
@="URL:Handinput Protocol Handler"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\Handinput\DefaultIcon]
@="C:\\Program Files (x86)\\SogouInput\\Components\\HandInput\\1.1.0.328\\handinput.exe"
[HKEY_CLASSES_ROOT\Handinput\shell]
[HKEY_CLASSES_ROOT\Handinput\shell\open]
[HKEY_CLASSES_ROOT\Handinput\shell\open\command]
@="\"C:\\Program Files (x86)\\SogouInput\\Components\\HandInput\\1.1.0.328\\handinput.exe\" \"%1\""

该内容主要功能就是把插件写到注册表。

保存并退出文件,然后运行该文件。

三、调用方式(我用的是js调用方式)

function sogo() //打开手写输入法
        {
            window.location.href="Handinput://test"
        }
function close() //关闭手写输入法

        { 
           let cmd=new ActiveXObject("WScript.Shell");
           cmd.run("taskkill /f /t /im handinput.exe",0);
        }

<body>
    <input type="text" id="msg" οnfοcus="sogo()" />
    <input type="button" value="Send" οnclick="close()"  />
</body>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值