您的位置:程序门 -> vc/mfc -> 基础类



多文档中如何在主窗口mainfrm中获得当前doc的指针?


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


多文档中如何在主窗口mainfrm中获得当前doc的指针?
发表于:2007-07-26 09:08:05 楼主
多文档中如何在主窗口mainfrm中获得当前doc的指针?
我获得的老是null,
怎么办????
发表于:2007-08-24 10:36:121楼 得分:0
我也遇到了这个问题,并成功解决,现与大家分享:

cmyframe*   pchildframe   =   null;
cdocument   *doc   =   null;
cmyview*   pcurview   =   null;
pchildframe   =   (cmyframe*)this-> mdigetactive();
assert(pchildframe);
doc   =   pchildframe-> getactivedocument();
assert(doc);
position   pos   =   doc-> getfirstviewposition   ();
while   (pos   !=   null)
{
cview   *pview   =   doc-> getnextview   (pos);
if   (pview-> iskindof(runtime_class(cmyview)))
{
((cmyview   *)(pview))-> myviewfun();
}
}


快速检索

最新资讯
热门点击