BOOL SetMenuItemBitmaps(hMenu,nPosition,wFlags,hBitmapUnchecked,hBitmapChecked)
This function associates the specified bitmaps with a menu item. Whether the menu item is checked or unchecked, Windows displays the appropriate bitmap next to the menu item.
Parameter | Type/Description |
hMenu | HMENU Identifies the menu to be changed. | |
nPosition | WORD Specifies the menu item to be changed. If wFlags is set to MF_BYPOSITION, nPosition specifies the position of the menu item; the first item in the menu is at position 0. If wFlags is set to MF_BYCOMMAND, then nPosition specifies the command ID of the menu item. | |
wFlags | WORD Specifies how the nPosition parameter is interpreted. It may be set to MF_BYCOMMAND (the default) or MF_BYPOSITION. | |
hBitmapUnchecked | HBITMAP Identifies the bitmap to be displayed when the menu item is not checked. | |
hBitmapChecked | HBITMAP Identifies the bitmap to be displayed when the menu item is checked. |
The return value specifies the outcome of the function. It is TRUE if the function is successful. Otherwise, it is FALSE.
If either the hBitmapUnchecked or the hBitmapChecked parameters is NULL, then Windows displays nothing next to the menu item for the corresponding attribute. If both parameters are NULL, Windows uses the default checkmark when the item is checked and removes the checkmark when the item is unchecked.
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 checkmark used for menu items. The application should use these values to determine the appropriate size for the bitmaps supplied with this function.