STM_SETIMAGE message

An application sends an STM_SETIMAGE message to associate a new image with a static control.

Parameters

wParam

Specifies the type of image to associate with the static control. This parameter can be one of the following values:

Value Meaning
IMAGE_BITMAP
Bitmap.
IMAGE_CURSOR
Cursor.
IMAGE_ENHMETAFILE
Enhanced metafile.
IMAGE_ICON
Icon.

lParam

Handle to the image to associate with the static control.

Return value

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

Remarks

To associate an image with a static control, the control must have the proper style. The following table shows the style needed for each image type.

Image type Static control style
IMAGE_BITMAP SS_BITMAP
IMAGE_CURSOR SS_ICON
IMAGE_ENHMETAFILE SS_ENHMETAFILE
IMAGE_ICON SS_ICON

Important

In version 6 of the Microsoft Win32 controls, a bitmap passed to a static control using the STM_SETIMAGE message was the same bitmap returned by a subsequent STM_SETIMAGE message. The client is responsible to delete any bitmap sent to a static control.

With Windows XP, if the bitmap passed in the STM_SETIMAGE message contains pixels with nonzero alpha, the static control takes a copy of the bitmap. This copied bitmap is returned by the next STM_SETIMAGE message. The client code may independently track the bitmaps passed to the static control, but if it does not check and release the bitmaps returned from STM_SETIMAGE messages, the bitmaps are leaked.

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

STM_GETIMAGE