zoukankan      html  css  js  c++  java
  • DocView 之间相互访问

     
    1)   在View中获得Doc指针     
        
      CYourSDIDoc   *pDoc=GetDocument();一个视只能有一个文档。   
        
      2)   在App中获得MainFrame指针   
      CWinApp   中的   m_pMainWnd变量就是MainFrame的指针   
      也可以:     
        
      CMainFrame   *pMain   =(CMainFrame   *)AfxGetMainWnd();   
        
      3)   在View中获得MainFrame指针     
        
      CMainFrame   *pMain=(CmaimFrame   *)AfxGetApp()->m_pMainWnd;   
        
      4)   获得View(已建立)指针     
        
      CMainFrame   *pMain=(CMainFrame  *)AfxGetApp()->m_pMainWnd;   
        
      CYourView   *pView=(CYourView  *)pMain->GetActiveView();   
        
      5)   获得当前文档指针     
        
      CDocument   * pCurrentDoc   =(CFrameWnd   *)m_pMainWnd->GetActiveDocument();   
        
      6)   获得状态栏与工具栏指针     
        
      CStatusBar   *   pStatusBar=(CStatusBar   *)AfxGetMainWnd()->GetDescendantWindow(AFX_IDW_STATUS_BAR);   
        
      CToolBar   *   pToolBar=(CtoolBar   *)AfxGetMainWnd()->GetDescendantWindow(AFX_IDW_TOOLBAR);   
        
      7)   如果框架中加入工具栏和状态栏变量还可以这样     
        
      (CMainFrame   *)GetParent()->m_wndToolBar;   
        
      (CMainFrame   *)GetParent()->m_wndStatusBar;   
        
      8)   在Mainframe获得菜单指针     
        
      CMenu   *pMenu=m_pMainWnd->GetMenu();   
        
      9)   在任何类中获得应用程序类   
      用MFC全局函数AfxGetApp()获得。
  • 相关阅读:
    第221题:最大正方形
    第238题:除自身以外数组的乘积
    简单易懂的拓扑排序
    第207题 课程表
    第198题:打家劫舍
    第四章 初始化与清理
    【笔记】jquery判断两个日期之间相差多少天
    【笔记】spring定时器时间配置实例
    【笔记】jquery加减乘除及科学计算法处理
    string 日期相加和相减
  • 原文地址:https://www.cnblogs.com/ahuo/p/3020818.html
Copyright © 2011-2022 走看看