我需要从Windows8(桌面winform.NET)下的程序中关闭tabtip键盘。我发现可以在需要的时候打开它,运行TabTip.exe来显示Windows 8 Touch键盘,但我无法在需要时关闭它!我试着用process.kill来终止这个过程,但它不起作用,有人知道怎么做?
问候Jean-claude
Tabtip.exe打开,然后生成两个进程,然后再次关闭。因此process.kill命令不起作用,因为原始进程已经关闭。
这将查看所有打开的进程,并关闭任何与tabtip相关的进程。
For Each pkiller As Process In Process.GetProcesses
If String.Compare(pkiller.ProcessName, "tabtip", True) = 0 Then
pkiller.Kill()
End If
Next
尝试以下操作-用TabTip 替换Osk
公共类Form1
Private oskProcess As Process
Private Sub openButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles openButton.Click
If Me.oskProcess Is Nothing OrElse Me.oskProcess.HasExited Then
If Me.oskProcess IsNot Nothing AndAlso Me.oskProcess.HasExited Then
Me.oskProcess.Close()
End If
Me.oskProcess = Process.Start("osk")
End If
End Sub
Private Sub closeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles closeButton.Click
If Me.oskProcess IsNot Nothing Then
If Not Me.oskProcess.HasExited Then
'CloseMainWindow would generally be preferred but the OSK doesn't respond.
Me.oskProcess.Kill()
End If
Me.oskProcess.Close()
Me.oskProcess = Nothing
End If
End Sub
最终类
我发现了一个用于控制屏幕键盘的未记录的COM接口。查看我的另一个答案以了解详细信息https://stackoverflow.com/a/40921638/332528