In order for this to work you need to follow these steps
- Go to “Project”, Select “
Properties…” - Click on “Compile”, At the bottom of the screen click on “Advanced Compile Options…”
- Change “Target CPU:” to “AnyCPU” and click “OK”
Public Class Form1
Private oskProcess As System.Diagnostics.Process
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Create the OSK Process
oskProcess = System.Diagnostics.Process.Start("osk.exe")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.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
Originally Posted on October 9, 2013
Last Updated on October 26, 2015
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.