프로그래밍/c++2013. 4. 26. 11:38

BOOL CMainFrame::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle, CWnd* pParentWnd, CCreateContext* pContext)
{
 // base class does the real work

 if (!CFrameWndEx::LoadFrame(nIDResource, dwDefaultStyle, pParentWnd, pContext))
 {
  return FALSE;
 }


 // enable customization button for all user toolbars
 BOOL bNameValid;
 CString strCustomize;
 bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE);
 ASSERT(bNameValid);

 for (int i = 0; i < iMaxUserToolbars; i ++)
 {
  CMFCToolBar* pUserToolbar = GetUserToolBarByIndex(i);
  if (pUserToolbar != NULL)
  {
   pUserToolbar->EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize);
  }
 }

// 프로그래머가 임의로 수정한 MFC ui를 수정하기 위해서는 레지스트리를 변경해줘야 하는 번거로움이 있는데

// 아래와 같은 소스 두줄이면 말끔히 해결!!

// 참고 : http://blog.naver.com/PostView.nhn?blogId=m1122314&logNo=30125697756 

m_wndMenuBar.RestoreOriginalstate();
m_wndToolBar.RestoreOriginalstate();

 return TRUE;
}



Posted by GaePein