W
W.G. Rowland
In some ways I'm starting to miss the simpler days of VB5..
Anyway, here's my problem. I'm trying to build a MSDE client using an MDI
Parent/Child interface. Enough of the tasks the program will have to
perform are time consuming that I would like to build a progress indicator
dialogue to track progress so the user knows things are going on.
Now, to avoid display corruption from long processes tying up the thread I'm
running longer routines (like the one that transfers the old Access database
into the new SQL format and takes several minutes) I'm running these
processes in their own threads. This allows me to keep all the UI code in
one thread, and not have the display corrupt..
The problem I have is not knowing how to pass information from the worker
thread to the UI thread.. Specifically, I need the worker thread to be able
to tell the progress window when it needs to update information (up the
value of the progress bar, change the caption to tell the user what's going
on, etc.), and also to let the progress window know when the worker thread
is done, so it can terminate itself..
From my research it seems I should probably be creating events and handlers
for the progress window, which I know how to do (I think..), and then having
the worker thread raise the events (or call methods in the progress window
that raise them)..
That's the part I don't know how to do.. How do I get code in one thread to
call routines in another?
Can anyone help me out? I've been beating my head against this one all day,
and all I have to show for it is a headache..
Thanks in advance,
W.G. Rowland
Anyway, here's my problem. I'm trying to build a MSDE client using an MDI
Parent/Child interface. Enough of the tasks the program will have to
perform are time consuming that I would like to build a progress indicator
dialogue to track progress so the user knows things are going on.
Now, to avoid display corruption from long processes tying up the thread I'm
running longer routines (like the one that transfers the old Access database
into the new SQL format and takes several minutes) I'm running these
processes in their own threads. This allows me to keep all the UI code in
one thread, and not have the display corrupt..
The problem I have is not knowing how to pass information from the worker
thread to the UI thread.. Specifically, I need the worker thread to be able
to tell the progress window when it needs to update information (up the
value of the progress bar, change the caption to tell the user what's going
on, etc.), and also to let the progress window know when the worker thread
is done, so it can terminate itself..
From my research it seems I should probably be creating events and handlers
for the progress window, which I know how to do (I think..), and then having
the worker thread raise the events (or call methods in the progress window
that raise them)..
That's the part I don't know how to do.. How do I get code in one thread to
call routines in another?
Can anyone help me out? I've been beating my head against this one all day,
and all I have to show for it is a headache..
Thanks in advance,
W.G. Rowland