ARCHIVE ...

MFC 클래스간 통신 본문

MFC

MFC 클래스간 통신

냐옹이. 2010. 2. 7. 17:37

SDI에서 각 개체 얻는 방법

  • App
    CWinApp * pApp = (CWinApp*)AfxGetApp();
  • MainFrame
    CMainFrame * pFrame = (CMainFrame *)AfxGetMainWnd();
  • Document
    CMainFrame * pFrame = (CMainFrame *)AfxGetMainWnd();
    CDocument *pDoc = CDocument *)pFrame->GetActiveDocument();
  • View
    CMainFrame * pFrame = (CMainFrame *)AfxGetMainWnd();
    CView *pView = (CView *)pFrame->GetActiveView();

MDI에서 각 개체 얻는 방법

  • App
    CWinApp *pApp = (CWinApp*)AfxGetApp();
  • MainFrame
    CMainFrame *pFrame = (CMainFrame *)AfxGetMainWnd();
  • ChildFrame
    CMainFrame *pFrame = (CMainFrame *)AfxGetMainWnd();
    CChildFrame *pChild = (CChildFrame *)pFrame->GetActiveFrame();
  • Document
    CMainFrame *pFrame = (CMainFrame *)AfxGetMainWnd();
    CChildFrame *pChild = (CChildFrame *)pFrame->GetActiveFrame();
    CDocument *pDoc = (CDocument *)pChild->GetActiveDocument();
  • View
    CMainFrame *pFrame = (CMainFrame *)AfxGetMainWnd();
    CChildFrame *pChild = (CChildFrame *)pFrame->GetActiveFrame();
    CView *pView = (CView *)pChild->GetActiveView();
Comments