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
Last Updated on October 26, 2015