我需要从 Windows 8(桌面 winform .NET)下的程序中关闭 tabtip 键盘。我发现在需要时打开它,运行 TabTip.exe 以显示 Windows 8 Touch 键盘,但我无法在需要时关闭它!我试图用 process.kill 杀死进程,但它不起作用,有人知道怎么做吗?
问候让-克劳德
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
公开课形式1
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