SetMenuItemBitmaps function
Associates the specified bitmap with a menu item. Whether the menu item is selected or clear, the system displays the appropriate bitmap next to the menu item.
Syntax
BOOL WINAPI SetMenuItemBitmaps( _In_ HMENU hMenu, _In_ UINT uPosition, _In_ UINT uFlags, _In_opt_ HBITMAP hBitmapUnchecked, _In_opt_ HBITMAP hBitmapChecked );
Parameters
- hMenu [in]
-
Type: HMENU
A handle to the menu containing the item to receive new check-mark bitmaps.
- uPosition [in]
-
Type: UINT
The menu item to be changed, as determined by the uFlags parameter.
- uFlags [in]
-
Type: UINT
Specifies how the uPosition parameter is to be interpreted. The uFlags parameter must be one of the following values.
- hBitmapUnchecked [in, optional]
-
Type: HBITMAP
A handle to the bitmap displayed when the menu item is not selected.
- hBitmapChecked [in, optional]
-
Type: HBITMAP
A handle to the bitmap displayed when the menu item is selected.
Return value
Type: BOOL
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
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 CXMENUCHECK and CYMENUCHECK values to retrieve the bitmap dimensions.
Examples
For an example, see Simulating Check Boxes in a Menu.
Requirements
|
Minimum supported client |
Windows 2000 Professional [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also