로그인

검색

API/MFC
2012.08.02 21:24

MFC 클래스간 통신

조회 수 2547 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 게시글 수정 내역 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 게시글 수정 내역 댓글로 가기 인쇄

http://whiteat.com/zbxe/?mid=WhiteAT_c&page=2&document_srl=3259


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 = (CTestDoc *)((CMainFrame *)AfxGetMainWnd())->GetActiveDocument();


4.     View 포인터 얻기

CMainFrame *pFrame = (CMainFrame *)AfxGetMainWnd();
CTestView *pView = (CTestView *)pFrame->GetActiveView();
CTestView *pView = (CTestView *) ((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();
CDsp240Doc *pDoc = (CDsp240Doc *)pChild->GetActiveDocument();
CDsp240Doc *pDoc = ( CDsp240Doc *)(((CMainFrame *)AfxGetMainWnd())->
    GetActiveFrame())->GetActiveDocument();

3.     View 포인터 얻기
CCainFrame *pFrame = (CMainFrame)AfxGetMainWnd();
CChildFrame *pChild = (CChildFrame *)pFrame->GetActiveFrame();     
CMdiTestView *pView = (CMdiTestDoc *)pChild->GetActiveView();
CMdiTestView *pView = ( CMdiTestView  *)(((CMainFrame *)AfxGetMainWnd())->GetActiveFrame())
    ->GetActiveView();

주의 사항
위의 방법으로 포인터를 얻을 때는 해당되는 파일을 include 할때 순서의 주의해야 한다.
#include "MainFrm.h"      // 1. Mainfrm
#include "Dsp240Doc.h"    // 2. Doc
#include "Dsp240View.h"   //  3. View


추가 사항

다이얼로그에서 모달창 또는 모달리스창을 띄운 후 메인 다이얼로그에 접근하려면

CxxxxxDlg* pMainDlg = (CxxxxxDlg*)AfxGetApp()->m_pMainWnd;

pMainDlg->someVariable 등의 형식으로 접근 가능


http://blog.naver.com/shin450279?Redirect=Log&logNo=40037253777

?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 Tool/etc Programming 게시판 관련 2 MoA 2014.11.01 6813
36 LLM [번역]거대언어모델(LLM) 가이드 OBG 2023.07.20 624
35 Deeplearning Top 3 most used Pytorch Ecosystem Libraries you should Know about OBG 2023.08.02 1365
34 Deeplearning LSTM-AE를 이용한 시퀀스 데이터 이상 탐지 OBG 2023.08.14 659
33 Deeplearning 내 마음대로 선정한 머신러닝/딥러닝 학습 추천 서적 OBG 2023.08.14 1263
32 Deeplearning 마이크로소프트가 공개한 무료 AI 코스들 OBG 2023.11.28 1206
31 Site 모든 개발자를위한 10 가지 특별한 GitHub 리포지토리 OBG 2023.12.28 1024
30 Site 10 Useful/Fun/Weird Github Repos You Have to Play Around With OBG 2023.12.28 1164
29 Tool/etc How to stop programmers to copy the code from GitHub when they leave the company? OBG 2024.01.02 878
28 Deeplearning [ifkakao] 추천 시스템: 맥락과 취향 사이 줄타 OBG 2024.01.10 638
27 서버 멀티-플레이어 게임 서버와 레이턴시 보상 테크닉 OBG 2024.01.16 726
26 Deeplearning Using Machine Learning to Predict Customers’ Next Purchase Day OBG 2024.02.27 584
25 LLM [12월 1주] 떠오르는 '미스트랄 7B'...'라마 2' 이어 한국어 모델 세대교체 주도 OBG 2024.03.05 869
24 LLM A Beginner's Guide to Prompt Engineering with GitHub Copilot OBG 2024.04.04 513
23 LLM 만능 프롬프트 OBG 2024.04.07 1075
22 LLM How LLMs Work ? Explained in 9 Steps — Transformer Architecture OBG 2024.04.11 783
21 LLM Getting Started with Sentiment Analysis using Python OBG 2024.04.11 668
20 LLM Real-Time Stock News Sentiment Prediction with Python OBG 2024.04.11 825
19 LLM ChatGPT의 강력한 경쟁 언어모델 등장!, Mixtral 8x7B OBG 2024.04.14 839
18 LLM Mixture of Experts - Part 2 OBG 2024.04.14 696
17 LLM The difference between quantization methods for the same bits OBG 2024.04.14 507
Board Pagination Prev 1 ... 6 7 8 9 10 11 12 13 14 15 Next
/ 15