Adding CMFCToolBar to VS2017 MDI application

  • Thread starter Thread starter D3F84U
  • Start date Start date
D

D3F84U

Guest
Hello,


I am looking for a way to implement new CMFCToolBar in wizard generated MFC MDI application.

So far I added:

MainFrm.h

CMFCToolBar m_wndTransportBar;


MainFrm.cpp, OnCreate

if (!m_wndTransportBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndTransportBar.LoadToolBar(IDR_TRANSPORT))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}

CString strToolBarName2;
bNameValid = strToolBarName2.LoadString(IDS_TOOLBAR_TRANSPORT);
ASSERT(bNameValid);
m_wndTransportBar.SetWindowText(strToolBarName2);

CString strCustomize2;
bNameValid = strCustomize2.LoadString(IDS_TOOLBAR_CUSTOMIZE);
ASSERT(bNameValid);
m_wndTransportBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize2);


Toolbar will show and it will almost work however:

- If I undock my toolbar on next app open m_wndToolBar undocks.

- Customize menu does not work as expected

- Both menus(m_wndToolBar ) share same title - "Standard" -


Also it seems I need to reset registry because I changed title to "Transport" using IDS_TOOLBAR_TRANSPORT of string table.


THX.

Continue reading...
 

Similar threads

Z
Replies
0
Views
107
Zebedee6
Z
V
Replies
0
Views
137
VickyCool4U
V
V
Replies
0
Views
114
VickyCool4U
V
Back
Top