Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Windows Controls
Control Library
Button
Messages
 BM_SETIMAGE Message

  Switch on low bandwidth view
BM_SETIMAGE Message

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

Syntax

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

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 to the image to associate with the button.

Return Value

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
YesYesShow icon only.
NoYesShow icon and text.
YesNoShow text only.
NoNoShow text only

Message Information

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

See Also

BM_GETIMAGE
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
BM_SETIMAGE      Jakub Nietrzeba   |   Edit   |   Show History
BM_SETIMAGE on button without BS_ICON or BS_BITMAP flag has no effect on Windows XP
Tags What's this?: Add a tag
Flag as ContentBug
Text is lost      Jens_0   |   Edit   |   Show History

As Jakub correctly said, BS_ICON or BS_BITMAP needs to be set to display a bitmap. According to the table below, then there's no possiblity to have image and text at the same time??

Thanks

Tags What's this?: Add a tag
Flag as ContentBug
Works fine Win 7 RC      alweis   |   Edit   |   Show History
This function appears to work exactly as documented by this page in Win 7 RC. The table is a bit confusing but both text and image should display if neither BS_ICON or BS_BITMAP is not set.
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker