Re: CWinThread and Memory Leaks.

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: jim_OLP (jimh_at_mcg.net)
Date: 01/14/05


Date: 13 Jan 2005 19:14:29 -0800


[sigh...] As is so often the case I'm dealing with a large legacy
project and can't move the time-consuming operation into its own
thread. It has to access data in the main thread, so the progress
window has to be in the 'other' thread.

As you point out "ISTR that if you don't specify the main window for
a secondary UI thread, MFC sets it to the primary thread's main
window." I think that's what's happening and I think for some reason,
unprocessed messages are going to the main window in the main thread.
Maybe if I set m_pMainWnd in the 'progress' thread...

When I've done this in the past, the second thread has created a
full-blown MFC doc/frame/view lashup which probably satisfied all the
hidden requirements. This time I'm just creating a single modeless
dialog.



Relevant Pages