CMenu::SetMenuItemBitmaps

Syntax

BOOL SetMenuItemBitmaps( UINT nPosition, UINT nFlags, const CBitmap* pBmpUnchecked, const CBitmap* pBmpChecked);

Parameters

nPosition

Specifies the menu item to be changed. The interpretation of nPosition depends on the setting of nFlags as shown in the following list:

nFlags Interpretation of nPosition

MF_BYCOMMAND Specifies that the parameter gives the command ID of the existing menu item. This is the default if neither MF_BYCOMMAND nor MF_BYPOSITION is set.
MF_BYPOSITION Specifies that the parameter gives the position of the existing menu item (the first item is at position 0).

nFlags

Specifies how nPosition is interpreted.

pBmpUnchecked

Specifies the bitmap to use for menu items that are not checked.

pBmpChecked

Specifies the bitmap to use for menu items that are checked.

Remarks

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.

If either pBmpUnchecked or pBmpChecked is NULL, then Windows displays nothing next to the menu item for the corresponding attribute. If both parameters are NULL, Windows uses the default check mark when the item is checked and removes the check mark 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 Windows ::GetMenuCheckMarkDimensions function retrieves the dimensions of the default check mark used for menu items. The application uses these values to determine the appropriate size for the bitmaps supplied with this function. Get the size, create your bitmaps, then set them.

Return Value

TRUE if the function is successful; otherwise FALSE.

See Also

::GetMenuCheckMarkDimensions, ::SetMenuItemBitmaps