Re: Executing a method in a given thread context



Application.Run(hiddenForm);

Wouldn't this make the message pump work in the UI thread ?

No. It starts a new message pump on the current (calling) thread.

Looking at the code for Application.Run(Fomr) using Reflector, I see that
this method is doing much more than a simple message loop. This would result
in poor performance and maybe cause trouble with the mainform is used from a
worker thread. LocalModalMessageLoop looks promising but it still does too
much for a worker thread message pump.

--
Francois PIETTE
http://www.overbyte.be


.



Relevant Pages

  • Re: MFC and threads
    ... and I don't have to convert my worker thread into ... an UI thread by adding a superfluous message loop. ... worker thread is to do a lengthy, sequential operation that can proceed ... see far too many programmers doing is forcing weird implementations because they want ...
    (microsoft.public.vc.mfc)
  • Re: Question of worker thread
    ... > When a simple worker thread created at its beginning, ... Can add window and message loop to such a thread? ... MFC techniques. ...
    (microsoft.public.vc.mfc)
  • TextBox in another thread
    ... I use one worker thread to do some lengthy stuff. ... I want to output some text to my main thread with message loop. ... But the result is the cursor still remained at start! ... Alan ...
    (microsoft.public.dotnet.framework)

Loading