为什么创建视图会失败?!
我在propertypage 指定RECT里创建一个VIEW,为什么会创建失败?
创建代码如下:
CCreateContext pContext;
CWnd* pFrameWnd = this;
pContext.m_pCurrentDoc = NULL;
pContext.m_pNewViewClass = RUNTIME_CLASS(CZoomView);
pView =(CZoomView *) ((CFrameWnd*)pFrameWnd)->CreateView(&pContext);
ASSERT(pView);
pView->ShowWindow(SW_NORMAL);
pView->MoveWindow(rectpic);
在CFrameWnd::CreateView的ASSERT_KINDOF(CWnd, pView);有问题
CWnd* CFrameWnd::CreateView(CCreateContext* pContext, UINT nID)
{
ASSERT(m_hWnd != NULL);
ASSERT(::IsWindow(m_hWnd));
ASSERT(pContext != NULL);
ASSERT(pContext->m_pNewViewClass != NULL);
// Note: can be a CWnd with PostNcDestroy self cleanup
CWnd* pView = (CWnd*)pContext->m_pNewViewClass->CreateObject();
if (pView == NULL)
{
TRACE1("Warning: Dynamic create of view type %hs failed.\n",
pContext->m_pNewViewClass->m_lpszClassName);
return NULL;
}
ASSERT_KINDOF(CWnd, pView); //单步运行到这里就无法继续往下执行了
...............
}