DevStudio style Dockable Menu Bar
(does not require MSIE)

Developer Studio를 보면 메뉴가 툴바처럼 떨어지고 아무데나 붙고 하는
걸 볼 수 있습니다. 지금부터 구현하려는 게 바로 그겁니다. 여기서 소개할 코드는
물론 Codeguru에서 온거구요. Internet Explorer
4 이상버전이나 새로 버전업된 comctrl32.dll 도 필요하지 않아요.
그럼 직접 코드를 만들어 보자구요.
(1) 우선 MenuBar.h, MenuBar.cpp, SubclassWnd.h, SubclassWnd.cpp 이 네 개의 파일을 프로젝트에 추가합니다. 여길 눌러 다운받아요.
(2) MainFrm.h 파일에 MeunBar.h를 인클루드하고, CMenuBar의 멤버변수로 m_wndMenuBar를 추가합니다. 역시 아래의 소스코드를 참조하시길.. 굵은 글씨부분의 화살표 표시가 고친 부분입니다.
// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_MAINFRM_H__59C6C2C9_5E4C_11D3_BEA6_C60B38563CF0__INCLUDED_)
#define AFX_MAINFRM_H__59C6C2C9_5E4C_11D3_BEA6_C60B38563CF0__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "MenuBar.h" // <------------
class CMainFrame : public CFrameWnd
{
protected: // create from serialization only
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual
function overrides
//{{AFX_VIRTUAL(CMainFrame)
virtual BOOL PreCreateWindow(CREATESTRUCT&
cs);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext&
dc) const;
#endif
protected: // control bar embedded members
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
CMenuBar m_wndMenuBar;
// <-------------
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT
lpCreateStruct);
//
NOTE - the ClassWizard will add and remove member functions here.
//
DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before
the previous line.
#endif // !defined(AFX_MAINFRM_H__59C6C2C9_5E4C_11D3_BEA6_C60B38563CF0__INCLUDED_)