BOOL CCAXMessageLayerThread::InitInstance()
{
CWnd* pParent = CWnd::FromHandle(m_hwndParent);
CRect rect;
pParent->GetClientRect(&rect);
BOOL m_bWindowSuccess = m_wndCAXMsgLayerWindow.Create(_T("CMsgLayerWindow"),
WS_CHILD, rect,pParent,m_eController);if (m_bWindowSuccess)
{// It is important to set CWinThread::m_pMainWnd to the user interface
// window. This is required so that when the m_pMainWnd is destroyed,
// the CWinThread is also automatically destroyed. For insight into
// how the CWinThread is automatically destroyed when the m_pMainWnd
// window is destroyed, see the implementation of CWnd::OnNcDestroy
// in wincore.cpp of the MFC sources.//m_pMainWnd被赋值后窗口不动。

m_pMainWnd = &m_wndCAXMsgLayerWindow;
pParent->PostMessage(WM_WINDOW_CREATED,(WPARAM)m_wndCAXMsgLayerWindow.m_hWnd);
}return TRUE;
}