假设建立MFC工程名称为  MyTest;

//首先找到当前工程主框架

CMainFrame *pMainWnd =  (CMainFrame*)AfxGetApp()->m_pMainWnd;

//有主框架找到当前活动子框架
CMDIChildWnd *pChild =  (CMDIChildWnd *) pMainWnd->GetActiveFrame();

//由活动子框架,找到当前活动视图
CMyTestView *pView = (CMyTestView*) pChild->GetActiveView();

//当前活动是与文档通信函数GetDocument()

CMyTestDoc *pDoc=(CMyTestDoc *)pChild->GetActiveDocument();

或者

CMyTestDoc *pDoc=pView->GetDocument();

 

相关文章:

  • 2021-05-14
  • 2021-09-22
  • 2022-12-23
  • 2022-01-22
  • 2022-12-23
  • 2022-12-23
  • 2022-03-06
猜你喜欢
  • 2021-10-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-05
  • 2021-06-18
相关资源
相似解决方案