Reference : http://www.lovehana.com/category/Programming/Application?page=5
SDI 형태
1.MainFrame 얻기
CMainFrame *pFrame = (CmainFrame *) AfxGetMainWnd();
2.App 포인터 얻기
CTestApp *pApp = (CtestApp *) AfxGetApp();
3.Document 포인터 얻기
CMainFrame *pFrame = (CMainFrame *)AfxGetMainWnd();
CTestDoc *pDoc = (CTestDoc *)pFrame->GetActiveDocument();
CTestDoc *pDoc = ((CMainFrame *)AfxGetMainWnd())->GetActiveDocument();
4.View 포인터 얻기
CMainFrame *pFrame = (CMainFrame *)AfxGetMainWnd();
CTestView *pView = (CTestView *)pFrame->GetActiveView();
CTestView *pView = ((CMainFrame *)AfxGetMainWnd())->GetActiveView();
MDI 형태
1.ChildFrame 포인터 얻기
CMainFrame *pFrame = (CMainFrame *)AfxGetMainWnd();
CChildFrame *pChild = (CChildFrame *)pFrame->GetActiveFrame();
CChildFrame*pChild = ((CMainFrame *)AfxGetMainWnd())->GetActiveFrame();
2.Document 포인터 얻기
CMainFrame *pFrame = (CMainFrame)AfxGetMainWnd();
CChildFrame *pChild = (CChildFrame *)pFrame->GetActiveFrame();
CMdiTestDoc *pDoc = (CMdiTestDoc *)pChild->GetActiveDocument();
CMdiTestDoc *pDoc = (((CMainFrame *)AfxGetMainWnd())->GetActiveFrame())->GetActiveDocument();
3.View 포인터 얻기
CCainFrame *pFrame = (CMainFrame)AfxGetMainWnd();
CChildFrame *pChild = (CChildFrame *)pFrame->GetActiveFrame();
CMdiTestView *pView = (CMdiTestDoc *)pChild->GetActiveView();
CMdiTestView *pView = (((CMainFrame *)AfxGetMainWnd())->GetActiveFrame())->GetActiveView();
'IT_Programming > MFC · API' 카테고리의 다른 글
응용 프로그램을 최소 크기 만들기 / 에디트 박스에서 엔터키 확인 방법 (0) | 2007.12.25 |
---|---|
CoCreateInstance 함수 (0) | 2007.12.13 |
CWebBrowser2(웹브라우저 컨트롤)에서 POST 방식으로 데이터 넘기기 (0) | 2007.12.05 |
MFC 주요 클래스의 멤버 변수와 멤버 함수 (0) | 2007.09.24 |
Environment : Visual Studio .NET 2003 (0) | 2007.09.24 |