EnsureParentFrame()函数的用法?解决办法
EnsureParentFrame()函数的用法?
以下代码摘自winsplit.cpp
不知道EnsureParentFrame()是什么函数?
------解决方案--------------------
以下代码摘自winsplit.cpp
void CSplitterWnd::SetActivePane(int row, int col, CWnd* pWnd)
{
// set the focus to the pane
CWnd* pPane = pWnd == NULL ? GetPane(row, col) : pWnd;
if (pPane->IsKindOf(RUNTIME_CLASS(CView)))
{
CFrameWnd* pFrameWnd = EnsureParentFrame();
pFrameWnd->SetActiveView((CView*)pPane);
}
else
{
TRACE(traceAppMsg, 0, "Warning: Next pane is not a view - calling SetFocus.\n");
pPane->SetFocus();
}
}
不知道EnsureParentFrame()是什么函数?
------解决方案--------------------
_AFXWIN_INLINE CFrameWnd* CWnd::EnsureParentFrame() const
{
CFrameWnd* pFrameWnd = GetParentFrame();
EMSURE_VALID(pFrameWnd);
return pFrameWnd;
}