SetMenuItemBitmaps (Compact 2013)


This function associates a specified bitmap with a menu item.

BOOL SetMenuItemBitmaps (
  HMENU hMenu,
  UINT uPosition,
  UINT uFlags,
  HBITMAP hBitmapUnchecked,
  HBITMAP hBitmapChecked


[in] Handle to the menu that contains the menu item.


[in] The menu item to be changed, as determined by the uFlags parameter.


[in] Constant specifying how the uPosition parameter is interpreted. This parameter must be either the MF_BYCOMMAND or the MF_BYPOSITION constant. For more information, see Menu Constants.


[in] Handle to the bitmap that is displayed when the menu item is not selected.


[in] Handle to the bitmap that is displayed when the menu item is selected.

TRUE indicates success. FALSE indicates failure.

If either the hBitmapUnchecked or hBitmapChecked parameter is NULL, the system displays nothing next to the menu item for the corresponding check state. If both parameters are NULL, the system displays the default check-mark bitmap when the item is selected, and removes the bitmap when the item is not selected.

When the menu is destroyed, these bitmaps are not destroyed; it is up to the application to destroy them.

The selected and clear bitmaps should be monochrome. The system uses the Boolean AND operator to combine bitmaps with the menu so that the white part becomes transparent and the black part becomes the menu-item color. If you use color bitmaps, the results may be undesirable.

Use the GetSystemMetrics function with the SM_CXMENUCHECK and SM_CYMENUCHECK values to retrieve the bitmap dimensions.





© 2016 Microsoft