I was looking for an Office 2000 style menu bar with intelligent menus, but my searches were to no effect. So I’ve made a series of classes that emulate a style similar to Office 2000. These classes are based on work made by MB (mb2@geocities.co.jp) and Brent Corkum.
To use Office 2000 menu bar in your applications, you have to perform the following steps.
- Open MDI.rc file with Microsoft Visual C++ and copy every Dialog, String (from String Table) and Menu from this file to your project resource file.
- Copy Setup Menu from IDR_INT_MENU menu resource to your menu(s) if you want to include menu modification in your application.
- Copy every cpp and h file from directory containing library sources into your project folder. Include these files into your project.
- Edit MainFrm.h (main frame window header file) in your project
- Edit MainFrm.cpp (main frame window source file) in your project
- Edit MyApp.h (application header file) in your project
- Edit MyApp.cpp (application source file) in your project
- Compile and run your application.
If you wish to implement your own intelligent menu algorithms you can derive a class from CMenuBar and override the following functions:
WORD CMenuBar::IncMenuUsage(CMenuEx *pParent,
UINT pos,
WORD curusage)
BOOL CMenuBar::EvaluateIfGrayed(CMenuEx *pParent,
UINT pos,
WORD &curusage,
int iMed,
int iRange)
First function is called to increment current usage of menus. Second one is called to determine if a menu must be painted grayed or not. This function can also modify current usage of menus.If you need to store application defined data in menus you can use CMenuEx::GetExtraDataPtr(UINT) to obtain this extra data.
For suggestions and/or bug reports please e-mail me.
Downloads
Download demo project 1
Download demo project 2
Download source