Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » [Q] attach the CExtToolControlBar in a CExtResizableDialog Collapse All
Subject Author Date
Hyeon Soo Ryu Jun 27, 2009 - 1:33 AM

CExtToolControlBar    m_wndToolBar;


DDX_Control(pDX, IDC_EMAP_TOOLBAR, m_wndToolBar);


 if(!m_wndToolBar.Create(NULL,this, AFX_IDW_TOOLBAR) || !m_wndToolBar.LoadToolBar(IDR_TOOLBAR1))


  TRACE0("Failed to create toolbar\n");

  return -1;      // fail to create



 m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |  CBRS_GRIPPER);

 m_wndToolBar.m_bForceBalloonGradientInDialogs = TRUE;


    NULL, 0, 0, 0, 0,





BUT , executing   LoadToolBar(IDR_TOOLBAR1)...........  happens to the following Error.

Unhandled exception at 0x7c93120e ................

What is the problem? 


Technical Support Jun 27, 2009 - 1:39 PM

If you dropped toolbar as a custom control into your dialog template resource, then you should not invoke its Create() method. You also don’t need to invoke toolbar’s SetWindowPos() method. You should only invoke the dialog’s RepositionBars() method from dialog’s OnInitDialog(<code> and <code>OnSize()<code> methods. Please take a look at the ProfUIS_Controls sample application. The Menubar and Toolbars dialog page contains several toolbars and menu bar. All these bars are dropped into dialog form as custom dialog controls. The <code>CPageBase::OnInitDialog() method in this sample application includes several DDX entries for all the bars. The CPageBase::DoDataExchange() method just initialized toolbar but does not create them. The toolbar windows are created during dialog loading and then subclassed by DDX entries. The CPageBase::DoDataExchange() method finally invokes the CWnd::RepositionBars(0,0xFFFF,0); code which places all the bars near dialog borders. This code is also invoked from the CPageBase::OnSize() method and that’s why toolbars are always placed near dialog borders when dialog is resized.