반응형
- CWinApp
CWinApp* AfxGetApp(); - 메인프레임 윈도우
CWnd* AfxGetMainWnd(); - 뷰에서 도큐먼트
Document* CView::GetDocument(); - 뷰에서 뷰를 둘러싸고 있는 프레임윈도우
CFrameWnd* CWnd::GetParentFrame(); - 도큐먼트에서 뷰
POSITION pos = GetFirstViewPosition();
While(pos != NULL){
CView* pView = (CView*)GetNextView(pos);
if(pView->IsKindOf(RUNTIME_CLASS(CTestView))) {
pView->UpdateWindow(); }
} - 도큐먼트에서 프레임 윈도우
단일 도큐먼트: AfxGetMainWnd();
다중 도큐먼트: 도큐먼트에서 뷰를 얻고 그뷰에서 자신을 포함하는 프레임 윈도우 - 프레임 윈도우에서 뷰
CView* CFrameWnd::GetActiveView(); - 프레임 윈도우에서 도큐먼트
virtual CDocument* CFrameWnd::GetActiveDocument();
- example
- CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
CTESTDoc* pDoc = (CTESTDoc*)pFrame->GetActiveDocument();
POSITION pos = pDoc->GetFirstViewPosition();
CTESTView* pView = (CTESTView*)pDoc->GetNextView(); - CTESTDoc* pDoc = (CTESTDoc*)(((CMainFrame*)AfxGetMainWnd())->GetActiveDocument());
POSITION pos = pDoc->GetFirstViewPosion();
CTESTView* pView = (CTESTView*)pDoc->GetNextView(pos); - CTESTDoc* pDoc = (CTESTDoc*)((CMainFrame*)AfxGetApp()->m_pMainWnd)->GetActiveDocument();
POSITION pos = pDoc->GetFirstViewPosition();
CTESTView* pView = (CTESTView*)pDoc->GetNextView(pos); - CDocument* pDoc;
CView *pView;
POSITION pos;
pDoc = (CDocument*)((CMainFrame*)AfxGetMainWnd())->GetActiveDocument();
pos =pDoc->GetFirstViewPosition();
pView = pDoc->GetNextView(pos); - CTESTDoc* pDoc = GetDocument();
CView *pView;
POSITION pos;
pos = pDoc->GetFirstViewPosition();
while(pos!=NULL){
pView = (CView*)pDoc->GetNextView(pos);
if(pView->IsKindOf(RUNTIME_CLASS(CTESTView))){
pView;}
- CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
반응형
'C++' 카테고리의 다른 글
MFC Feature Pack - CMFCEditBrowseCtrl Get Path (0) | 2020.06.02 |
---|---|
"DTD cannot be used" when loading C++ xml DOM. Methods that can be used for error messages (0) | 2020.06.02 |
AfxGetMainWnd() (0) | 2020.05.28 |
How to use the CInternetSession OpenURL (0) | 2020.05.22 |
CInternetFile ReadString -- File Download (0) | 2020.05.19 |