[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

Calling parent thread to update GUI?

Siegfried Heintze

9/20/2002 6:30:00 PM

Wow! Broadcasting with SendMessage takes a long time. If I create a child
thread, can that thread call a function in the parent thread which is
declared to be STA? Do I have to do anything special so the parent thread
can update the GUI with a progress report?

When working in C++, I had to send a message.


4 Answers

Jon Skeet

9/20/2002 5:37:00 PM

0

Siegfried Heintze <siegfried@heintze.com> wrote:
> Wow! Broadcasting with SendMessage takes a long time. If I create a child
> thread, can that thread call a function in the parent thread which is
> declared to be STA? Do I have to do anything special so the parent thread
> can update the GUI with a progress report?
>
> When working in C++, I had to send a message.

There's not really any such thing as a "parent" thread AFAIK - but you
can ask the STA thread associated with a control to invoke a delegate
using Control.Invoke.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.c...
If replying to the group, please do not mail me too

Andrew Connell

9/20/2002 6:03:00 PM

0

That's what I'm trying to accomplish as well! Got more info or an example?
Haven't seen any help on having one thread talk to another.

-AC

"Jon Skeet" <skeet@pobox.com> wrote in message
news:MPG.17f551181bc68ced9897a5@msnews.microsoft.com...
| Siegfried Heintze <siegfried@heintze.com> wrote:
| > Wow! Broadcasting with SendMessage takes a long time. If I create a
child
| > thread, can that thread call a function in the parent thread which is
| > declared to be STA? Do I have to do anything special so the parent
thread
| > can update the GUI with a progress report?
| >
| > When working in C++, I had to send a message.
|
| There's not really any such thing as a "parent" thread AFAIK - but you
| can ask the STA thread associated with a control to invoke a delegate
| using Control.Invoke.
|
| --
| Jon Skeet - <skeet@pobox.com>
| http://www.pobox.c...
| If replying to the group, please do not mail me too


Jon Skeet

9/20/2002 6:07:00 PM

0

Andrew Connell <spam@aconnell.com> wrote:
> That's what I'm trying to accomplish as well! Got more info or an example?
> Haven't seen any help on having one thread talk to another.

Just set up a delegate, then call Invoke on the appropriate control with
the delegate.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.c...
If replying to the group, please do not mail me too

Tom Shelton

9/20/2002 7:22:00 PM

0


"Andrew Connell" <spam@aconnell.com> wrote in message
news:#CaKs6LYCHA.1676@tkmsftngp11...
> That's what I'm trying to accomplish as well! Got more info or an
example?
> Haven't seen any help on having one thread talk to another.
>

try these articles:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/d...
l/winforms06112002.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/d...
l/winforms08162002.asp

they helped me out a lot.

Tom Shelton