initialupdateframe(pframe, pdocument, bmakevisible);
文档模板的这个函数的实现为:
pframe->initialupdateframe(pdoc, bmakevisible);
实际是调用了框架窗口的同名函数:
void cframewnd::initialupdateframe(cdocument* pdoc, bool bmakevisible)
{
cview* pview = null;
if (getactiveview() == null)
{
//取主视图
cwnd* pwnd = getdescendantwindow(afx_idw_pane_first, true);
if (pwnd != null && pwnd->iskindof(runtime_class(cview)))
{
//主视图存在且合法,把当前的主视图设置为活动视图
pview = (cview*)pwnd;
setactiveview(pview, false);
}
}
if (bmakevisible)
{
sendmessagetodescendants(wm_initialupdate, 0, 0, true, true);
if (pview != null)
pview->onactivateframe(wa_inactive, this);