Look at my Answer to similar question:
providing COMPILER, DEBUGGER facility in IDE[
^].
A key here is to catch compiler output in
stdout
and
stderr
from the process you spawn. I explained it in my Answer. You can re-direct the stream and ready it in some thread which is permanently working and is sleeping (mode exactly, waiting at the blocking stream read operation) when compiler is not working. Every time the thread read some unit of output or error, if should notify UI.
You cannot operate with UI controls from the thread. Instead, you should use Invoke of Invoke required methods of
System.Windows.Forms.Control
(Forms only) or
System.Windows.Threading.Dispatcher
(good for both Forms and WPF). I described all the details here:
Control.Invoke() vs. Control.BeginInvoke()[
^]. See also
Problem with Treeview Scanner And MD5[
^].
For thread, I recommend use my other Answer which advised to create a thread wrapper for passing parameters to the thread while avoiding type casting:
How to pass ref parameter to the thread[
^].
—SA