MFC

MDI 구조 스파이플러스로 살펴보기 - 분석

디버그정 2008. 9. 4. 20:35
사용자 삽입 이미지


스파이로 mdi 샘플을 만들어서 살펴보았다....
예측상 메인프레임 - 차일드 프레임 - 뷰 이렇게 3계층도로 이루어질 줄 알았는데....
그 중간에 MDIClient 라는 클래스이름을 가진 윈도우가 위치함을 볼 수 있다.

sdk에서 다중문서템플릿 작성할 경우 사용되는 클래스이다.
mfc에서는 내부적으로 저 윈도우의 기능을 래퍼하고 있을 것이다.

구체적으로 메인프레임 자식이며 차일드프레임의 부모이다.
메인 프레임과 차일드 프레임 사이의 조정자 역할을 하고 있음을 볼 수 있다.
아래의 msdn 설명 참조
--------------------------------------------------------------------------------

MDI main frame windows (one per application) contain a special child window called the MDICLIENT window. The MDICLIENT window manages the client area of the main frame window, and itself has child windows: the document windows, derived from CMDIChildWnd. Because the document windows are frame windows themselves (MDI child windows), they can also have their own children. In all of these cases, the parent window manages its child windows and forwards some commands to them.

In an MDI frame window, the frame window manages the MDICLIENT window, repositioning it in conjunction with control bars. The MDICLIENT window, in turn, manages all MDI child frame windows. The following figure shows the relationship between an MDI frame window, its MDICLIENT window, and its child document frame windows.

MDI Frame Windows and Children

An MDI frame window also works in conjunction with the current MDI child window, if there is one. The MDI frame window delegates command messages to the MDI child before it tries to handle them itself.