Search

'전체 글'에 해당되는 글 113건

  1. 2005.10.21 View/Document구조에서 각각의 핸들 구하기.
CTestApp, CMainFrame, CTestDoc, CTestView

Afx 로 시작하는 것들은 전역함수들 이니까..
실은 어디에서나 사용 가능하겠죠....

◎ CTestApp에서
CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
CTestDoc* pDoc = (CTestDoc*)((CMainFrame*)AfxGetMainWnd())->GetActiveDocument();
CTestView* pView = (CTestView*)((CMainFrame*)AfxGetMainWnd())->GetActiveView();

◎ CMainFrame에서
CTestApp* pApp = (CTestApp*)AfxGetApp();
CTestDoc* pDoc = (CTestDoc*)GetActiveDocument();
CTestView* pView = (CTestView*)GetActiveView();

◎ CTestDoc에서
CTestApp* pApp = (CTestApp*)AfxGetApp();
CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
CTestView* pView = (CTestView*)((CMainFrame*)AfxGetMainWnd())->GetActiveView();

◎ CTestView에서
CTestApp* pApp = (CTestApp*)AfxGetApp();
CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
                  or (CMainFrame*)GetParent();
CTestDoc* pDoc = (CTestDoc*)((CMainFrame*)AfxGetMainWnd())->GetActiveDocument();
              or (CTestDoc*)GetDocument();


메인 -> doc -> 뷰 -> 기타 잡스러운 헤더 순으로 include!