Windows API Reference

Microsoft Developer Network

COMCTL32.dll API Reference

The COMCTL32.dll library provides a rich set of user interface controls and services, enabling the creation of modern and visually appealing Windows applications. This section details the functions available within this core component.

ImageList_Create

HIMAGELIST ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow);
Creates an empty image list. An image list is a collection of same-sized images, each of which can be associated with a color mask.

Parameters

  • cx: The width, in pixels, of each image in the image list.
  • cy: The height, in pixels, of each image in the image list.
  • flags: The type of image list to be created. This parameter can be a combination of the ILC_COLOR, ILC_MASK, ILC_COLORDDB, and ILC_PERITEM flags.
  • cInitial: The initial number of images that the image list can hold.
  • cGrow: The number of images by which the image list can grow when it needs more space.

Return Value

Returns the handle to the new image list if successful, or NULL otherwise.

Remarks

Images are added to the image list with ImageList_Add or ImageList_ReplaceIcon.

Use ImageList_Destroy to destroy the image list when you are finished with it.

Button_SetState

BOOL Button_SetState(HWND hwndButton, INT state);
Sets the state of a button.

Parameters

  • hwndButton: Handle to the button control.
  • state: The new state of the button. If this parameter is nonzero, the button is pressed; otherwise, it is not pressed.

Return Value

Returns TRUE if the state was set successfully, or FALSE otherwise.

ListView_GetItemCount

INT ListView_GetItemCount(HWND hwndListView);
Retrieves the number of items in a list-view control.

Parameters

  • hwndListView: Handle to the list-view control.

Return Value

Returns the number of items in the list-view control.

TreeView_InsertItem

HTREEITEM TreeView_InsertItem(HWND hwndTreeView, const LPTVINSERTSTRUCT ptis);
Inserts a new item into a tree-view control.

Parameters

  • hwndTreeView: Handle to the tree-view control.
  • ptis: Pointer to a TVINSERTSTRUCT structure that contains information about the item to be inserted.

Return Value

Returns the handle to the newly inserted item if successful, or NULL otherwise.