Re: Waiting for Dialog to update in a Nnew Thread
- From: "Alan Hadley" <alan_hadley@xxxxxxxxxxxxxxxx>
- Date: Sun, 06 Nov 2005 16:23:16 GMT
Thank's David, I tried it on one function and got rid of all of the _this->
prefixes, and the progress box updates on screen properly.
Now I just have to work out how to do one thing after another if one or both
are not in the main thread. The prevailing wisdom is that I should not use
an Event, so what do I do?
Alan
"David Wilkinson" <no-reply@xxxxxxxxxxxx> wrote in message
news:OO5X39s4FHA.4076@xxxxxxxxxxxxxxxxxxxxxxx
> Alan Hadley wrote:
>
>> Messy in the method I used, I rewrote the calculation functions so that
>> they could be started with AfxBeginThread and passed 'this' as the
>> parameter, then copied the parameter to a variable CCombineDoc
>> _this=param. then accessed the data which lives in my document class
>> with statements like _this->x. This has left all of my calculation
>> functions with a lot of _this-> thingies cluttering the code and whenever
>> I change anything I have to remember to include them or get loads of
>> error messages. So if I start a new thread for a calculation how do I
>> get at the data in my document class there is a lot of it, if I try to
>> access it directly I get error messages?
>
> What I always do is have the static thread function use its LPVOID
> parmeter to immediately call a non-static member of the class. Then you
> have what you really wanted -- a non-static thread function.
>
> And as others have told you always leave all the GUI in the main thread.
> Personally I use SendMessage to update the main thread from the worker
> thread, but you do need to be careful not to do anything in the main
> thread that could cause a blocking situation.
>
> David Wilkinson
.
- Follow-Ups:
- Re: Waiting for Dialog to update in a Nnew Thread
- From: Scott McPhillips [MVP]
- Re: Waiting for Dialog to update in a Nnew Thread
- References:
- Waiting for Dialog to update in a Nnew Thread
- From: Alan Hadley
- Re: Waiting for Dialog to update in a Nnew Thread
- From: Joseph M . Newcomer
- Re: Waiting for Dialog to update in a Nnew Thread
- From: Alan Hadley
- Re: Waiting for Dialog to update in a Nnew Thread
- From: David Wilkinson
- Waiting for Dialog to update in a Nnew Thread
- Prev by Date: Re: Accessing or Calling a Parents Methods or Functions from the Child (Update)
- Next by Date: Re: Global Causing Access Violation
- Previous by thread: Re: Waiting for Dialog to update in a Nnew Thread
- Next by thread: Re: Waiting for Dialog to update in a Nnew Thread
- Index(es):
Relevant Pages
|