SetMenuItemBitmaps

  BOOL SetMenuItemBitmaps(hmenu, uItem, fuFlag, hbmUnchecked, hbmChecked)    
  HMENU hmenu; /* handle of menu */
  UINT uItem; /* menu-item to receive new bitmaps */
  UINT fuFlag; /* menu-item flags */
  HBITMAP hbmUnchecked; /* handle of unchecked bitmap */
  HBITMAP hbmChecked; /* handle of checked bitmap */

The SetMenuItemBitmaps function associates the given with a menu item. Whether the menu item is checked or unchecked, Windows displays the appropriate bitmap next to the menu item.

Parameters

hmenu

Identifies the menu containing the item to receive new check mark bitmaps.

uItem

Specifies the menu item to be changed, as determined by the fuFlag parameter.

fuFlag

Specifies how the uItem parameter is interpreted. The fuFlag parameter can be one of the following values:

Value Meaning

MF_BYCOMMAND  
  The uItem parameter specifies the identifier of the menu item.
MF_BYPOSITION  
  The uItem parameter specifies the zero-based relative position of the menu item.

hbmUnchecked

Identifies the bitmap to be displayed when the menu item is not checked.

hbmChecked

Identifies the bitmap to be displayed when the menu item is checked.

Return Value

The return value is TRUE if the function is successful or FALSE if an error occurs. Use the GetLastError function to obtain extended error information.

Comments

If either the hbmUnchecked or the hbmChecked parameter is NULL, Windows displays nothing next to the menu item for the corresponding check state. If both parameters are NULL, Windows displays the default check mark bitmap when the item is checked and removes the bitmap when the item is not checked.

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

The GetMenuCheckMarkDimensions function retrieves the dimensions of the default check mark used for menu items. The application should use these values to determine the appropriate size for the bitmaps supplied with this function.

See Also

GetMenuCheckMarkDimensions