TommyTwoPints
asked on
Waiting for a process to finish
Hi experts,
I start a process using the following code;
Public pro As New System.Diagnostics.Process ()
Public proMRDCL As Process
Sub RunShellCommand()
Try
pro.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
pro.StartInfo.FileName = strMYPATH & "QBExports\QBmrdclEX.stp"
proMRDCL = System.Diagnostics.Process .Start(pro .StartInfo )
Catch
End Try
End Sub
What I want to do is send a character return to the process and then wait for the process to finish before killing it and my program carrying on running.
Can this be done?
Cheers,
Tom
I start a process using the following code;
Public pro As New System.Diagnostics.Process
Public proMRDCL As Process
Sub RunShellCommand()
Try
pro.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
pro.StartInfo.FileName = strMYPATH & "QBExports\QBmrdclEX.stp"
proMRDCL = System.Diagnostics.Process
Catch
End Try
End Sub
What I want to do is send a character return to the process and then wait for the process to finish before killing it and my program carrying on running.
Can this be done?
Cheers,
Tom
If the Process is ending by itself, you can use WaitForExit. See details at http://www.utmag.com/wconnect/wc.dll?LevelExtreme~9,7,10,,176
ASKER
Hi emoreau,
When i inserted the WaitForExit into my code, it freezes my pc at runtime.
Is there another way around this?
Cheers,
Tom
When i inserted the WaitForExit into my code, it freezes my pc at runtime.
Is there another way around this?
Cheers,
Tom
Try my demo to see if it is working.
ASKER
Hi Eric,
The demo works as it should but not how i want it.
I automatically open a program and run it. The amount of time the program takes to run is always going to be different (Due to the amount of data and different machine speeds).
I want to be able to wait until the program stops running then close it and move the output files it creates into other folders.
Basically i need to know when the program has stopped running.
Cheers,
Tom
The demo works as it should but not how i want it.
I automatically open a program and run it. The amount of time the program takes to run is always going to be different (Due to the amount of data and different machine speeds).
I want to be able to wait until the program stops running then close it and move the output files it creates into other folders.
Basically i need to know when the program has stopped running.
Cheers,
Tom
I have no idea. Can this program raise a signal to say it has finish?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.