FeaturesHere are just some of the cool features of this menu class.
- Vertical bitmap can be shown to the left side of menu items of popup menu, just like Windows start menu.
- Child controls can be placed on the menu window.
Usage Instructions:In order to use CBmpMenu class, user needs to use the standard functions implemented by CMenu for showing a popup menu. User creates an instance of CBmpMenu instead of CMenu and then uses LoadMenu or CreatePopupMenu followed by TrackPopupMenu.
User needs to provide handle of vertical bitmap in the constructor.
CBmpMenu(int nBitmapW=0, BOOL bShowBmp4SubMenu=FALSE, HBITMAP hBitmap=0, BOOL StretchBmp=TRUE);Explanation of arguments
- nBitmapW - Width of the blank space to be shown to the left side of menu items in a popup menu.
- bShowBmp4SubMenu - If TRUE, then blank space is shown for all submenus of a popup menu. If FALSE, then blank space is shown only for main menu.
- hBitmap - If a valid handle is passed then this bitmap is drawn on the blank space
- bStretchBmp - If TRUE, then bitmap is drawn using StretchBlt. If False, then the blank space is filled with pattern brush created from the bitmap.
If user wants to place any child controls on the menu window, he needs to do the processing in WM_ENTERMENULOOP handler.
WM_ENTERMENULOOP: // handle of menu which is entering the modal loop wParam = (HMENU)hMenu; //handle of menu window(menu window is of type CBmpMenu) lParam = (HEND)hWindow;
Using hWindow as parent window, any child controls can be created and placed on the menu window.
DownloadsDownload demo project - 40 Kb
Download source - 14 Kb