|
-
March 29th, 1999, 09:45 AM
#1
Update views from an worker thread
Hi all,
I'm writing an application that have a worker thread : this thread read data from a serial port; at the end of this thread I must update the views of my program. I call the function "CDocument::UpdateAllViews" from my thread but the application generate an application-error.
How can I update the views from my worker thread ?
Thanks in advance for your answer.
-
March 29th, 1999, 10:49 AM
#2
Re: Update views from an worker thread
Try posting a user-defined message to the main application window, and creating a message handler (maybe in the document itself) for that message that calls CDocument::UpdateAllViews. This will ensure that UpdateAllViews is called by the main application thread rather than the worker thread.
-
April 21st, 1999, 07:19 AM
#3
Re: Update views from an worker thread
For the above proposed solution, If the worker thread throws a user-defined message, how to map so that member function of document is called. If I use AfxGetApp->SendMessage(), then only WinApp derived class can map the message...?
Is there any other way.. thanks for any help.!
-
April 21st, 1999, 08:24 AM
#4
Re: Update views from an worker thread
You can use AfxGetMainWnd()->SendMessage() to send it to the FrameWnd and handle
the message in the frameWnd. In the handler call UpdateAllviews fn. This will solve the pbm I think.
--Mythili
-
April 30th, 1999, 05:02 AM
#5
Re: Update views from an worker thread
This is failing in release version, why? Mail me at [email protected]. Thank you.
Waiting for reply
Dinesh
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|