Reputation: 1044
I know how to send parameters to the child program via startinfo.arguments
. I think I even know how to "listen" to anything the child might "say" via standardoutput.readline
. What I don't know is what method to use for the child to "speak" back to the parent. Here is the code I have so far (on the parent side):
Dim proc As Process
Dim bRunProgramWorked As Boolean = True
Try
proc = New Process
Dim procInfo As New ProcessStartInfo
proc.StartInfo.FileName = strPathUpgradeEXE
proc.StartInfo.Arguments = param1 & " " & param2 & " " & param3
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
'proc.StartInfo.WindowStyle = ProcessWindowStyle.Maximized
proc.StartInfo.UseShellExecute = False
proc.StartInfo.CreateNoWindow = True
proc.StartInfo.RedirectStandardOutput = True
'proc.StartInfo.RedirectStandardError = True
proc.Start()
Dim output1 As String = proc.StandardOutput.ReadLine
Dim output2 As String = proc.StandardOutput.ReadLine
proc.WaitForExit()
proc.Close()
proc.Dispose()
Catch ex As Exception
LogIt(strMyBaseID, "Error at trying to run PVT-Export. " & ex.ToString)
bRunProgramWorked = False
End Try
Upvotes: 1
Views: 219