From: DaveB on 15 Mar 2010 06:18
On Jan 22, 12:06 am, Peter Duniho <no.peted.s...(a)no.nwlink.spam.com>
> Alberto Poblacion wrote:
> > "momonga" <shira...(a)kk.iij4u.or.jp> wrote in message
> >> i need something like the PostMessage in win32.
> >> to order the main-thread to perform the job on befalf of the worker-
> >> thread.
> > The closest equivalent would be the Post method of the
> > SynchronizationContext. In your main thread you would do something like
> > ctx=SynchronizationContext.Current; then, in the other thread, you
> > could do ctx.Post(callback, arguments); The callback would then be
> > executed in the main thread.
> >> please could you tell me how to do that?
> > There is another, possibly simple way. Call the Invoke method of any
> > Control (including the form) by passing a callback delegate. The
> > callback method will be invoked in the main thread.
> I agree with your suggestion to use Invoke().
> However, note that the Control.BeginInvoke() method is basically the
> same as the SynchronizationContext.Post() method is basically the same
> as the unmanaged PostMessage() function, in that all three are a "queue
> and continue" operation, while Invoke(), Send(), and SendMessage() are
> all a "queue and wait" operation.
> If the OP really wants "queue and continue" semantics, they should use
> Control.BeginInvoke() instead.
> Pete- Hide quoted text -
> - Show quoted text -
There's some more explanation and background in these posts that might