Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Windows Controls
Control Library
Static Control
Messages
 STM_SETIMAGE Message
STM_SETIMAGE Message

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

Syntax

To send this message, call the SendMessage function as follows.
lResult = SendMessage(    // returns HANDLE in lResult
   hWndControl,           // (HWND) handle to destination control
   STM_SETIMAGE,          // (UINT) message ID
   wParam,                // = () wParam; 
   lParam                 // = (LPARAM)(HANDLE) lParam;
);

Parameters

wParam

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

IMAGE_BITMAP
IMAGE_CURSOR
IMAGE_ENHMETAFILE
IMAGE_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 typeStatic control style
IMAGE_BITMAPSS_BITMAP
IMAGE_CURSORSS_ICON
IMAGE_ENHMETAFILESS_ENHMETAFILE
IMAGE_ICONSS_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 Microsoft Windows XP, if the bitmap passed in the STM_SETIMAGE message contains pixels with non-zero 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.

Message Information

HeaderDeclared in Winuser.h, include Windows.h
Minimum operating systems Windows 95, Windows NT 3.51

See Also

STM_GETIMAGE
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker