AFX_MANAGE_STATE(AfxGetStaticModuleState());
CPanel *dlg=new CPanel();
dlg->Create(IDD_PANEL,parent);
dlg->ShowWindow(SW_SHOW);
void CWnd::AssertValid() const
{
...
else
{
// should be a normal window
ASSERT(::IsWindow(m_hWnd));
// should also be in the permanent or temporary handle map
CHandleMap* pMap = afxMapHWND();
ASSERT(pMap != NULL);//停在这句了
...
}
修正方法
参数不要用窗口指针. 用句柄, 改成
...
dlg->Create(IDD_PANEL, CWnd::FromHandle(hWnd) );
...