B
brian.gabriel
I am trying to kick of a DOS program from a VB.Net service. The
program works fine when called from a batch file, and from a Windows
form, but it has problems when called from a service. The program runs
successfully but does not give control back to the service.
After the Process.Start statement no code will execute. The program
has exited and is not shown in process monitor. I am running the
service under an admin account.
See my code below.
Thanks for any help!
Brian
Dim myProcess As New Process
myProcess.StartInfo.FileName = strProcess
myProcess.StartInfo.Arguments = strArguments
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.WorkingDirectory = strPath
myProcess.StartInfo.UseShellExecute = False
Try
'Kick off the program
myProcess.Start()
'No code after here will run!!
' wait until it exits
myProcess.WaitForExit()
LogToFile("Converted File")
Catch ex As Exception
LogToFile(ex.Message & " " & ex.Source)
ErrorHandler(ex.Message & " " & ex.Source)
End Try
program works fine when called from a batch file, and from a Windows
form, but it has problems when called from a service. The program runs
successfully but does not give control back to the service.
After the Process.Start statement no code will execute. The program
has exited and is not shown in process monitor. I am running the
service under an admin account.
See my code below.
Thanks for any help!
Brian
Dim myProcess As New Process
myProcess.StartInfo.FileName = strProcess
myProcess.StartInfo.Arguments = strArguments
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.WorkingDirectory = strPath
myProcess.StartInfo.UseShellExecute = False
Try
'Kick off the program
myProcess.Start()
'No code after here will run!!
' wait until it exits
myProcess.WaitForExit()
LogToFile("Converted File")
Catch ex As Exception
LogToFile(ex.Message & " " & ex.Source)
ErrorHandler(ex.Message & " " & ex.Source)
End Try