CWnd::PostMessage in dialog based app
Posted on 1998-06-25
I'm writing a dialog based app using MFC (VC5). The main window is a Wizard (CPropertySheet). One page contains a modified CStatic control. This control sends notifications to it's parent window using GetParent()->PostMessage(...). On another page, I start a worker thread, which is also sending messages to the dialog using ::PostMessage(...) with the correct window handle.
If I'm creating a debug version with standard settings, everything works fine. But when I run the release version, I can exactly do ONE PostMessage. If it comes to the second one, the program crashes with an 0xC0000005: Access Violation in MFC42.DLL. The debugger stops in AFXCRIT.CPP, line 100. The call stack is CWnd::~CWnd -> AfxLockGlobals, if this information is helpfull...
What could be the cause for this strange behaviour?