I have a problem with my code. I am checking for the application instance. When i run application A , application B also must run. Below is my code to check the Application B if it is not running i have to make sure the code below execute it. Application B is located at desktop.
I have problem with the code below. It seems doesn't work and i couldn't find where is the problem. Anyone can help me !!! Thank You.
Dim sPath As String = Application.StartupPath & "\APPLICATION B.exe" If Process.GetProcessesByName("APPLICATION B.exe").LongLength = 0 Then Debug.Print("1 sPath=>" & sPath) File.Exists(sPath) Debug.Print("2 sPath=>" & sPath) Dim ShellProcess As New Process ShellProcess.StartInfo.FileName = sPath Debug.Print("ShellProcess.StartInfo.FileName=>" & ShellProcess.StartInfo.FileName) ShellProcess.StartInfo.UseShellExecute = True Debug.Print("ShellProcess.StartInfo.UseShellExecute=>" & ShellProcess.StartInfo.UseShellExecute) ShellProcess.Start() Debug.Print("ShellProcess.Start=>" & ShellProcess.Start) ShellProcess.WaitForExit() End If