Problem with worker thread
-
Hi, i am using multithreading in my application. I want to use MFC object(view and MainFrame object) in my worker thread. Can anybody tell how to do this. Thanks.
What do you mean by "use?" Worker threads (i.e., those without a message pump) should not interact with UI components other than to post a message to the component's owner. The owner is therefore responsible for updating the UI component.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
-
Hi, i am using multithreading in my application. I want to use MFC object(view and MainFrame object) in my worker thread. Can anybody tell how to do this. Thanks.
From within your worker thread you have a handle to its parent. Using this handle you'll be able to use/interact with this MFC object. Marc Soleda. ... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits. -- modified at 10:46 Thursday 8th September, 2005
-
Hi, i am using multithreading in my application. I want to use MFC object(view and MainFrame object) in my worker thread. Can anybody tell how to do this. Thanks.
No, you don't want to use your view and mainframe objects in a worker thread. That will cause a disaster of biblical proportions. Those objects belong to the GUI thread. The way your work thread will interact with the GUI is by passing the thread a pointer to the view or mainframe window, and then posting messages to this window. Go to flounder.com and read Dr Newcomber's articles on threading.
-
Hi, i am using multithreading in my application. I want to use MFC object(view and MainFrame object) in my worker thread. Can anybody tell how to do this. Thanks.
ashtwin wrote: . I want to use MFC object(view and MainFrame object) in my worker thread. Can anybody tell how to do this. you will find this article intresting :)- http://www.codeproject.com/threads/usingworkerthreads.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV