Cool Popup Menu | CodeGuru

Cool Popup Menu

Features Here 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 […]

Written By
CodeGuru Staff
CodeGuru Staff
Jan 22, 2000
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

Features

Here 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.

The parameters for WM_ENTERMENULOOP has been changed by CbmpMenu
class.

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.

Advertisement

Downloads

Download demo project – 40 Kb
Download source – 14 Kb

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.