Help Center

CToolbar.SetImageListmethod

Sets the image list that the toolbar will use to display buttons that are in their default state.

WindowsmethodCToolbar.incdocumented

Syntax

FUNCTION SetImageList (BYVAL hToolbar AS HWND, BYVAL himlNew AS HIMAGELIST) AS HIMAGELIST

Parameters

NameDescription
hToolbarHandle to the toolbar control.
himlNewHandle to the image list to set. If this parameter is NULL, no images are displayed in the buttons.

Return value

Returns the handle to the image list previously used to display buttons in their default state, or NULL if no image list was previously set.

Description

Sets the image list that the toolbar uses to display buttons that are in their default state.

Remarks

Your application is responsible for freeing the image list after the toolbar is destroyed.

The TB_SETIMAGELIST message cannot be combined with TB_ADDBITMAP. It also cannot be used with toolbars created with CreateToolbarEx, which calls TB_ADDBITMAP internally. When you create a toolbar with CreateToolbarEx or use TB_ADDBITMAP to add images, the toolbar manages the image list internally. Attempting to modify it with TB_SETIMAGELIST has unpredictable consequences.

Reference

  • Include file CToolbar.inc
  • Defined in AfxNova/CToolbar.inc:1095
  • Documented in Windows/WIndows Controls/CToolbar Class.md
  • Topic: CToolbar Class