In MFC the UI related operation (Draw paint) can be performed in worked thread? My problem is as of now the main thread is taking lot of time in drawing the UI related items. But if i can delegate the UI drawing related operation to worked thread section by section the main thread becomes free so that the remaining part of the application which is done with drawing can be used by user. Is this possible?
Asked
Active
Viewed 275 times
1 Answers
1
You should do the opposite. In general the main application thread should be used for GUI stuff only as it has Windows Message Pump by default. The rest of work should be done in threads.

Andrew Komiagin
- 6,446
- 1
- 13
- 23
-
Thank you Andrew. But in my case requirement is slightly different. there are multiple windows. So once the first widow in done with drawing , if the worker threads can do the drawing part for the other windows then main thread becomes free and the end user can start his interaction with the first window while others windows are still in loading state. Any solution? – GAP Jun 17 '15 at 18:13
-
Nope. Drawing should be done in main thread only. Otherwise you'll end up having problems with message pump. – Andrew Komiagin Jun 17 '15 at 18:23
-
Thank you Andrew. Is there any other approach i can follow to achieve my requirement? – GAP Jun 18 '15 at 01:40
-
I need more information about your app to give you an advise. I assume that you can put loading/rendering/calculation part into a thread. While these tasks are in progress the main GUI thread can track their completion state and display it using `CProgressCtrl` – Andrew Komiagin Jun 18 '15 at 06:47