close屏幕上的键盘事件单击按钮时发生的事件 [英] close Event for Onscreen keyboard on button click event

查看:92
本文介绍了close屏幕上的键盘事件单击按钮时发生的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个带有按钮单击事件的屏幕键盘.
此功能被称为或在屏幕键盘上运行.....

I have created one on-screen keyboard with button click event..
This function is called or run onscreen key board.....

private void loginControl1_btnOnScreenProcessKeyboardUser(object sender, EventArgs e)
       {
           if (p == null)
           {
               string Pproccename;
               pid = 0;
               p = System.Diagnostics.Process.Start("osk");
               pid = p.Id;
               Pproccename =  p.ProcessName.Trim();
           }
           else
           {
               p.Kill();
               p.Dispose();
               p = null;
           }
       }


现在,我已使用该函数或该代码关闭了该过程


Now I have closed that process with that function or that code

 if (p1id > 0)
//if (p1 != null)
{
    p1.Kill();
    p1.Dispose();
    p1 = null;
}
else if (pid > 0)
// else if (p != null)
{
    p.Kill();
    p.Dispose();
    p = null;
}


它应该可以关闭屏幕键盘...
但是当您直接单击键盘关闭按钮时,则会出现错误..所以告诉我该怎么办?
给我答案...


It should work to close screen keyboard...
but when you click keyboard close directly then it gives error.. so tell me what should I do?
Give me answer...

推荐答案

问题是您正在杀死一个进程,即使该进程已关闭其自身.如果是这样,请在调用kill之前检​​查p.HasExited;
Is the problem that you are killing a process even though it has closed its self down. If so check p.HasExited before calling kill;


这篇关于close屏幕上的键盘事件单击按钮时发生的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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