CMainFrame (2) 썸네일형 리스트형 SDI, MDI 기반의 프로젝트에서 타이틀바 내용 변경하기(CREATESTRUCT structure) BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs cs.style &= ~FWS_ADDTOTITLE ; cs.lpszName = "Maestro Server Ver1.0"; // SetWindowText("Maestro Server Ver1.0") 대체 가능 // 단, OnCreate() 에서의 호출을 추천 // 덤으로 cs.cx, cx.cy 등을 이용하면 프로그램 틀의 크기 조정도 가능하다. return TRUE; } CMainFrame 사용하기 CMainFrame *pMainFrm= (CMainFrame *) AfxGetMainWnd(); AfxGetMainWnd() 함수는 윈도우의 포인터를 얻어오는 함수이다. CWnd* 값을 가져오는데 이는 윈도우의 멤버 변수인 m_pMainWnd의 값을 리턴한다. CMainFrame 에서의 Doc , View 로드 방법으로는 GetActiveDocument(), CGetActiveView() 등이 있다, 리턴 값은 각각 CDocument , CView 의 포인터 형이며 타입 캐스팅으로 원하는 뷰를 사용할 수 있다. 이전 1 다음