각 클래스에서 객체 얻기
MainFrame 얻기 |
CMainFrame *pFrame = (CmainFrame *) AfxGetMainWnd(); |
App 포인터 얻기 |
CTestApp *pApp = (CtestApp *) AfxGetApp(); |
Document 포인터 얻기(새로 만든 클래스에서 얻어올때) |
#include "TestDoc.h" #include "MainFrm.h" CTestDoc *pDoc = (CTestDoc*)((CMainFrame *)AfxGetMainWnd())->GetActiveDocument(); |
View 포인터 얻기(새로 만든 클래스에서 얻어올때) |
#include "TestView.h" #include "MainFrm.h" CTestView *pView = (CTestView*)((CMainFrame *)AfxGetMainWnd())->GetActiveView(); |
자식 Dialog에서 부모 Dialog 포인터 얻기 |
CParent* pDlg = (CParent*)GetParent(); |
부모 Dialog에서 자식 Dialog 포인터 얻기 |
CChild dlg.m_variant; |
CView에서 CDocument 객체 얻어올때 |
GetDocument() |
CView에서 CFrameWnd 객체 얻어올때 |
GetParentFrame() |
CDocument에서 CView객체 얻어올때 |
GetFirstViewPosition(), GetNextView() |
CFrameWnd에서 CView 객체 얻어올때 |
GetActiveView() |
CFrameWnd에서 CDocument 객체 얻어올때 |
GetActiveDocument() |
Afx로 시작하는 함수는 전역함수라 어디서든 사용가능 | |
AfxAbort() |
어플리케이션 무조건 종료 |
AfxMessageBox() |
메시지 상자를 표시 |
AfxGetApp() |
어플리케이션 객체의 포인터 리턴 |
AfxGetAppName() |
어플리케이션 명을 리턴 |
AfxGetMainWnd() |
메인 프레임 윈도우 포인터 리턴 |
AfxGetInstanceHandle() |
현재 인스턴스 핸들 리턴 |
'Sunmoon_BIT > Microsoft Foundation Class' 카테고리의 다른 글
Socket통신 LIST의 ADDSTRING 에러 (0) | 2010.11.04 |
---|---|
M3(2) (0) | 2010.11.03 |
M3(1) (0) | 2010.11.03 |
Updatedata() 함수 (0) | 2010.03.12 |
MFC 전역함수 (0) | 2010.03.04 |