BM_SETIMAGE message

Associates a new image (icon or bitmap) with the button.

Parameters

wParam

The type of image to associate with the button. This parameter can be one of the following values:

  • IMAGE_BITMAP
  • IMAGE_ICON

lParam

A handle (HICON or HBITMAP) to the image to associate with the button.

Return value

The return value is a handle to the image previously associated with the button, if any; otherwise, it is NULL.

Remarks

The appearance of text, an icon, or both on a button control depends on the BS_ICON and BS_BITMAP styles, and whether the BM_SETIMAGE message is called. The possible results are as follows:

BS_ICON or BS_BITMAP Set? BM_SETIMAGE Called? Result
Yes Yes Show icon only.
No Yes Show icon and text.
Yes No Show text only.
No No Show text only

Requirements

Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Header
Winuser.h (include Windows.h)

See also

BM_GETIMAGE