Open and close Windows 8 touch keyboard tabtip under desktop

放肆的年华 提交于 2019-12-21 17:06:16

问题


I need to close the tabtip keyboard from a program under Windows 8 (desktop winform .NET). I found to open it when need, run TabTip.exe to display the Windows 8 Touch keyboard, but i can't close it when i need! I tried to kill the process with process.kill but it doesn't work, someone has an idea how to do it?

Regards Jean-claude


回答1:


Try the below- Replace Osk with TabTip

Public Class 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

End Class




回答2:


Tabtip.exe opens, then spawns two process before closing again. So the process.kill command does not work because the originating process is already closed.

This looks through all the open processes and closes anything tabtip related.

For Each pkiller As Process In Process.GetProcesses
      If String.Compare(pkiller.ProcessName, "tabtip", True) = 0 Then
          pkiller.Kill()
      End If
Next



回答3:


I discovered an undocumented COM interface for controlling the on-screen keyboard. Check my other answer for the details https://stackoverflow.com/a/40921638/332528



来源:https://stackoverflow.com/questions/14746263/open-and-close-windows-8-touch-keyboard-tabtip-under-desktop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!