I will try and make my question with out being too long winded. I have
been doing a lot of reading on how to do multithreading and I have
implemented the code from the following example on codeproject and
msdn.
http://www.codeproject.com/csharp/LaunchProcess.asp
http://msdn.microsoft.com/msdnmag/is...g/default.aspx
In the eample Standard out is read like this:
void ReadStdOut()
{
string str;
while ((str = process.StandardOutput.ReadLine()) != null)
{
FireAsync(StdOutReceived, this, new
DataReceivedEventArgs(str));
}
}
The reason for this is because ReadStdOut is in a separate thread. And
then FireAsync Calls methods registered on the UI Thread to the
StdOutRecieved delegate.
This works great if I am running a Windows Forms app and I can pass a
control into the contructor of ProcessCaller. Then FixAsync just uses
the controls BeginInvoke method to call back to the UIThread.
My Question is, If I want this to work for a console app as well will
the events get to the proper Main thread if I just fire the delegate
instead of using BeginInvoke? There are no controls in the Console
App, so I don't have a BeginInvoke call.
Please let me know if I can clairify any of this.
Thanks for your help
Adam dR.