如何从c#关闭TabTip虚拟键盘 [英] How to close TabTip virtual keyboard from c#

查看:1075
本文介绍了如何从c#关闭TabTip虚拟键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的wpf应用程序中使用TabTip.exe作为虚拟键盘。当我试图杀死进程时,它不会被杀死并抛出异常"Access is Denied"。

I am using TabTip.exe as virtual keyboard in my wpf application. When I am trying to kill the process it's not getting killed and throwing exception "Access is Denied".

TabTip版本是10.0.16299.64,我认为是较新的版本。以前版本的TabTip在下面的代码中工作正常。

TabTip version is 10.0.16299.64, which I think is the newer version. The previous version of TabTip was working fine with the code below.

Process [] tabtip = Process.GetProcessesByName(" TabTip");

Process[] tabtip = Process.GetProcessesByName("TabTip");

if(null!= tabtip)

{

        tabtip.ToList()。ForEach(a => {if(null!= a){a.Kill();}});

}

if (null != tabtip)
{
       tabtip.ToList().ForEach(a => { if (null != a) { a.Kill(); } });
}

即使我发现了一件事。如果TabTip已打开,并且从任务管理器我选择该过程并单击"结束进程",那么它也不会被关闭。关闭TabTip的唯一方法是单击其上的关闭按钮。

Even I observed one thing. If TabTip is open and from Task Manager I am selecting the process and clicking "End Process", then also it's not getting closed. The only way to close the TabTip is to click the close button present on it.

我需要帮助,如何关闭它或通过代码(c#)杀死它。

I need help, how to close it or kill it by code (c#).

推荐答案

Hi MinaketanBiswal,

Hi MinaketanBiswal,

>> 我需要帮助,如何关闭它或通过代码杀死它(c#)。

>>I need help, how to close it or kill it by code (c#).

如果您想通过代码关闭TabTip.exe,可以查看以下代码:

If you want to close TabTip.exe by code, you can take a look the following code:

 private Process _p = null;
        private void btn2_Click(object sender, RoutedEventArgs e)
        {
          _p= Process.Start(@"C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe");
            //_p = Process.Start("osk.exe");
        }
        private void btn3_Click(object sender, RoutedEventArgs e)
        {
          if(_p!=null)
            {
                _p.Kill();
                _p.Dispose();
                _p = null;
            }
               
            
        }

最好的问候,

Cherry





这篇关于如何从c#关闭TabTip虚拟键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆