Visual Studio/Office 97 style Flat Toolbar and Dockable Menu bar

Download source files and Sample project (287 Kb).

This is a menu/toolbar/dockbar combination which is as close to the VC5/Office style as I could get.

This code consists of 9 classes:


The standard CDockBar overlaps the toolbars by a couple of pixels, which is undesirable if you want a '3d' look as we do. This is just a simple hack to remove the overlap on our toolbars.


This is the draggable menu. It creates a toolbar with text items only and TBSTYLE_DROPDOWN style. It attempts to emulate the operation of a VC/Office menu as accurately as possible. When a button is clicked, the menu creates a window of type CNGenericPopup, which draws the menu. A single menu is created by the frame window class.


This draws a standard popup menu, but passes keypresses (left/right arrow mainly) to the owner toolbar. At present it doesn't put the icons on the left as in VC5, but this should be trivial to implement. It uses a standard CMenu object, walks each menu item and draws it. A current limitation of this implementation is that it doesn't support submenus.


This is based on the code by Roger Onslow, with modifications to allow displaying of text on the buttons, and accelerator keys. This works as a drop in replacement for CToolBar. Functions:


Extended create function.

	BOOL SetVisualState(BOOL bButtons, BOOL bText)

Calling CNGenericToolBar::SetVisualState() allows you to set how toolbars are shown (with/without bitmaps or text). It is usual to do this on your CMainFrame::OnCreate.

	BOOL GetVisualState(BOOL bText)                   Return visibility of text or bitmaps on toolbars.
	BOOL GenericToolBarModifyStyle(DWORD dwRemove, 
	                               DWORD dwAdd)       Adds/removes extended toolbar styles
	                NGTB_NO_SYSMENU                   (Override system menu on undocked toolbars)
	DWORD GetGenericToolBarStyle()                    Returns current extended toolbar style


A quick hack to handle the change of menu when a document is opened/closed. If anyone has a better way to do this I'd be glad to hear it!


Subclass of CNGenericMenu with an added function to subclass the MDIClient for MDI apps.


Overrides necessary parts of CMDIFrameWnd, to allow proper hotkey operation of the menu/toolbar and to replace the CDockBar for the frame. Fairly trivial to use - just derive your CMainFrame from this & the menus work automatically.


Implements extended style NTGB_NOSYSMENU in toolbar styles (see CNGenericToolBar)


Overrides necessary parts of CFrameWnd, to allow proper hotkey operation of the menu/toolbar and to replace the CDockBar for the frame.


VC++5 with service pack 3.
commctrl.dll 4.71 or above.

Simple usage:

Create an MDI or SDI app. Add the following to the end of your stdafx.h

#include "NGToolbar.h"

Complex(!) usage:

Derive your main frame from CNMDIFrameWnd or CNSDIFrameWnd Use CNGenericToolBar instead of CToolBar You can set the text that appears on the toolbar buttons by putting a third 'line' in its associated text (eg. xxx\nyyyy\nzzz). To set the startup state of a toolbar call CNGenericToolBar::SetVisualState.

Rebuilding NGTLB10x.DLL:

VC++5 with service pack 3.
commctrl.dll 4.71 or above.
Up to date commctrl.h

Build will create NGTLB10R.DLL for release and NGTLB10D.DLL for debug. Library inclusion is automatic (see NGToolbar.h)

Note: Compilation requires an up to date commctrl.h from Microsoft. There is one at

Updated 5 May 1998.


  • Hoofdtelefoon isnot slechts een hoofdtelefoon, is een venster op de wereld te zien

    Posted by mrswanzi on 06/05/2013 11:16pm

    [url=]beats by dre kopen[/url] Naast dat je je muziek wireless kunt beluisteren via bluetooth kun je er ook altijd nog voor kiezen om gewoon de meegeleverde kabel te gebruiken. Bijvoorbeeld wanneer je via een apparaat luisterd wat geen bluetooth ondersteund. Of als dat batterijen voor de bluetooth funcie leeg zijn (deze gaan ongeveer 10 uur lang mee).De komende de Monster Beats Dr Dre urBeats koptelefoon [url=]beats by dre[/url] Beats By Dre Kopen doe je bij een geautoriseerde dealer. Bij een geautoriseerde dealer weer je zeker dat je een originele beats by dre koopt. Tevens heeft het kopen bij een geautoriseerde dealer het voordeel dat je ook weet dat je garantie goed zit. De dealer handelt samen met jouw garantiekwesties af. Onofficiele gaan dit soort dingen het liefst uit de weg. [url=]beats by dre kopen[/url] Beleef nu echt de muziek zoals die bedoeld is met de Beats by Dr Dre Studio koptelefoon, Beats by Dr Dre Studio de hoge kwaliteit koptelefoon gemaakt door de top arties Dr Dre. Veel mensen zijn aan slecht geluids kwaliteit gewent, dat ik ook niet zo gek. Al die lage kwaliteit speakers, oordopjes en koptelefoons die je overal tegen komt¡­ mensen moesten eens weten wat ze missen¡­ Als je eenmaal aan de kwaliteit standaard van deze koptelefoon gewent bent wil je niet meer anders!

  • menu _ save _ open

    Posted by Legacy on 11/05/2003 12:00am

    Originally posted by: Hanhlona

    assume i create a project in SDI, when i run my program, how can i save the data that the user input in it and how can i open the file i saved?
    Please help me
    Thank you

  • Problems with menues

    Posted by Legacy on 03/20/2002 12:00am

    Originally posted by: Frog

    Is there a fix for the problems with vertikal docked menues? If the menu is vertikal docked the menue items get lost, because they were placed like horizontal docked. And there is a second problem. The menue bar has a close SysIcon in the caption bar. If you close the menue you will never get it!

  • Vc6.0 bugs fix. (Release version for the toolbar)

    Posted by Legacy on 07/09/2001 12:00am

    Originally posted by: taobell

    When you build release version for the toolbar.
    you may get four errors.

    Add follows to Afxcmn.inl(vc98\mfc\include)
    #if (_WIN32_IE >= 0x0400)
    #define TreeView_SetInsertMarkColor(hwnd, clr) \
    #define TreeView_GetInsertMarkColor(hwnd) \
    #endif // (_WIN32_IE >= 0x0400)

    It is not a very clever method.but it works..;)

  • Open problems

    Posted by Legacy on 03/28/2001 12:00am

    Originally posted by: Israel Rosas Hernandez

    I downloaded the Project but I can not open it. I have Visual C++ 6.0. Can you sende me a copy. I think that maybe the file is corrupted.


  • Doesn't supply keyboard

    Posted by Legacy on 08/21/2000 12:00am

    Originally posted by: SnowFei

    This menu in Lib doesn't supply keyboard.
    1.when u push the ALT key down and up,the menu doesn't emboss.
    2.when u push the ALT_F key down and up,u can't cancel the drop menu with ESC key,ALT key and mouse event.
    3.this time u cann't select the other submenu and the NUM,CAP,SCR in statubar don't work,too.
    Sorry, i am not good at English.
    i hope you can know my means!

  • Problem with *! menus

    Posted by Legacy on 05/10/2000 12:00am

    Originally posted by: hugh

    I have a number of 'top level' menus, ie menus that directly lauch a command, rather than a sub menu.
    It appears that these classes don't recognise this case. I cannot figure out how, or where to intercept it. Can anyone help please?

  • rebuild in VC++6

    Posted by Legacy on 04/04/2000 12:00am

    Originally posted by: Frank

    I try to rebuild the dll in release version but i have some errors like this. 
    E:\Visual Studio\VC98\MFC\INCLUDE\afxcmn.inl(326) : error C2065: 'TVM_GETINSERTMARKCOLOR' : undeclared identifier

    The same problem appears when i want to rebuild the client project in release version

    Please, help me


  • loading icons from a resource ?

    Posted by Legacy on 08/30/1999 12:00am

    Originally posted by: rinix

    Very nice work !
    and I'll use the auto-subclassing feature for my future custom controls

    Just one question :
    How to load the icons from a resource (from the toolbar resource or a resource-only dll with icons or a bitmap) ?


  • Bugs with VC 6.0 (2)

    Posted by Legacy on 07/28/1999 12:00am

    Originally posted by: Viktor

    I've got similar problems trying to work with Your sample projects in VC 6.0. It's really good idea to make samples easier (more understandable I mean).

    Thank You.

  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • As all sorts of data becomes available for storage, analysis and retrieval - so called 'Big Data' - there are potentially huge benefits, but equally huge challenges...
  • The agile organization needs knowledge to act on, quickly and effectively. Though many organizations are clamouring for "Big Data", not nearly as many know what to do with it...
  • Cloud-based integration solutions can be confusing. Adding to the confusion are the multiple ways IT departments can deliver such integration...

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date