when i run my system in .exe file i got error[unhandled exception has occurred in your application] , i used this code

Public Class Form1
    Declare Function Wow64DisableWow64FsRedirection Lib "kernel32" (ByRef oldvalue As Long) As Boolean
    Declare Function Wow64EnableWow64FsRedirection Lib "kernel32" (ByRef oldvalue As Long) As Boolean
    Private osk As String = "C:\Windows\System32\osk.exe"
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Dim old As Long
        If Environment.Is64BitOperatingSystem Then
            If Wow64DisableWow64FsRedirection(old) Then
                Process.Start(osk)
                Wow64EnableWow64FsRedirection(old)
            End If
        Else
            Process.Start(osk)
        End If
    End Sub
End Class

Edited 1 Year Ago by jez9

O.K. I just played around with it. In Solution Explorer make sure you have selected Any CPU as target. Then I put, just for testing, this line on top of form1.load:

 Private oskProcess As Process

and just called in form load:

 Process.Start("osk.exe")

which worked fine when running the exe.

This question has already been answered. Start a new discussion instead.