Having Trouble with WaitForExit

oggmorg

Member
Joined
Jan 25, 2012
Messages
16
Programming Experience
1-3
hi all, im having some trouble with waitforexit not waiting.. im trying the following

Dim myProcess As Process = System.Diagnostics.Process.Start("mstsc.exe", root & "AutoRDP\Temp.rdp")
myProcess.WaitForExit()

but its not waiting, i think this is due to it launching then starting a new instance.. can anyone help with this??

Thanks
 
hi all, im having some trouble with waitforexit not waiting.. im trying the following

Dim myProcess As Process = System.Diagnostics.Process.Start("mstsc.exe", root & "AutoRDP\Temp.rdp")
myProcess.WaitForExit()

but its not waiting, i think this is due to it launching then starting a new instance.. can anyone help with this??

Thanks

i have found that this is due to my application being x86, starting mstsc from a x86 application on a x64 machine, starts the version in syswow, then closes and opens the x64 version.. anyone have any clue on how to work around this??
 
i have found that this is due to my application being x86, starting mstsc from a x86 application on a x64 machine, starts the version in syswow, then closes and opens the x64 version.. anyone have any clue on how to work around this??

if anyones interested...

Process.Start("C:\Windows\Sysnative\mstsc.exe")

will do it
 
Hi,

i uses this workaround for checking if mstsc is not running anymore;

Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
Dim MyProcess As Process

MyProcess = Process.Start("mstsc.exe ", "/v p-name")
Threading.Thread.Sleep(1500)


While IsProcessRunning("mstsc") = True
End While
MessageBox.Show("RDP Exit")

End Sub

Public Function IsProcessRunning(ByVal name As String) As Boolean
For Each clsProcess As Process In Process.GetProcesses()
If clsProcess.ProcessName.StartsWith(name) Then
Return True
End If
Next
Return False
End Function
 
Back
Top