Re: Form freezing form
- From: "Willy Denoyette [MVP]" <willy.denoyette@xxxxxxxxxx>
- Date: Thu, 26 May 2005 21:29:26 +0200
"Ioannis Vranos" <ivr@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:OoZNByhYFHA.2756@xxxxxxxxxxxxxxxxxxxxxxx
> Tamas Demjen wrote:
>
>> When you update the form from the thread, are you taking care of the
>> synchronization? Only the main thread is allowed to modify the GUI, you
>> can't do it directly from the thread, you have to do the update via
>> Control::Invoke.
>
>
> Do you mean I should create a delegate for this? However my question is
> this, as far as I understand, before the Application::DoEvents() use, the
> form got "frozen" because of the frequency of the updates. Why this will
> not happen when Invoke() is used?
Because your actual work is done on another thread and as such doesn't block
the thread's message pump, the only thing what's done on the UI thread is
updating the UI (paint, handle mouse moves/clicks, KB input etc...).
Note that Control.Invoke and (preferable) BeginInvoke simply post a message
(that basically contains the address of the function to execute) to the
message queue, such that the function is executed on the UI thread (well the
thread owning the Control).
Willy.
.
- Follow-Ups:
- Re: Form freezing form
- From: Ioannis Vranos
- Re: Form freezing form
- References:
- Form freezing form
- From: Ioannis Vranos
- Re: Form freezing form
- From: Willy Denoyette [MVP]
- Re: Form freezing form
- From: Ioannis Vranos
- Re: Form freezing form
- From: Ioannis Vranos
- Re: Form freezing form
- From: Tamas Demjen
- Re: Form freezing form
- From: Ioannis Vranos
- Form freezing form
- Prev by Date: Re: an OpenFileDialog problem
- Next by Date: Re: Networking question
- Previous by thread: Re: Form freezing form
- Next by thread: Re: Form freezing form
- Index(es):
Relevant Pages
|