HDITEM

This structure contains information about an item in a header control. This structure has been updated to support header item images and order values.

At a Glance

Header file: Commctrl.h
Windows CE versions: 2.0 and later

Syntax

typedef struct _HDITEM {
UINT mask;
int cxy;
LPTSTR pszText;
HBITMAP hbm;
int cchTextMax;
int fmt;
LPARAM lParam;
int iImage;
int iOrder;
}
HDITEM;

Members

mask

Specifies which other structure members contain valid data or must be filled in. It can be a combination of the following values:

Value Description
HDI_BITMAP The hbm member is valid.
HDI_FORMAT The fmt member is valid.
HDI_HEIGHT The cxy member is valid and specifies the item’s height.
HDI_IMAGE The iImage member is valid and specifies the image to be displayed with the item.
HDI_LPARAM The lParam member is valid.
HDI_ORDER The iOrder member is valid and specifies the item’s order value.
HDI_TEXT The pszText and cchTextMax members are valid.
HDI_WIDTH The cxy member is valid and specifies the item’s width.

cxy

Width or height of the item.

pszText

Pointer to a null-terminated item string. If this member is set to LPSTR_TEXTCALLBACK, the control will request text information for this item by using HDN_GETDISPINFO notification messages.

hbm

Handle to the item bitmap.

cchTextMax

Length of the item string, in characters.

fmt

Set of bit flags that specify the item’s format.

This member can include one of the following text justification or right-to-left reading order bit flags.

Value Description
HDF_CENTER The item’s contents are centered.
HDF_LEFT The item’s contents are left-aligned.
HDF_RIGHT The item’s contents are right-aligned.
HDF_RTLREADING Windows 95 only: Text is displayed using right-to-left reading order for Hebrew or Arabic systems.

The preceding flag is combined with one of the following flags.

Value Description
HDF_BITMAP The item displays a bitmap.
HDF_BITMAP_ON_RIGHT The bitmap appears to the right of text. This does not affect an image from an image list assigned to the header item.
HDF_OWNERDRAW The header control’s owner draws the item.
HDF_STRING The item displays a string.

Additionally, the following flag can be combined with any of the preceding flags.

Value Description
HDF_IMAGE The item displays an image from an image list.
You can use the HDF_JUSTIFYMASK mask to isolate the text justification portion of the fmt member.

lParam

Application-defined item data.

iImage

Zero-based index of an image within the image list. The specified image will be displayed in the header item, in addition to any image specified in the hbm member. If iImage is set to I_IMAGECALLBACK, the control requests text information for this item by using HDN_GETDISPINFO notification messages.

iOrder

Order in which the item appears within the header control, from left to right. That is, the value for the far left item is 0. The value for the next item to the right is 1, and so on.

Remarks

The header control can display text, an image and a bitmap for an item all at the same time. The alignment flags determine the order in which they appear. With HDF_LEFT or HDF_CENTER, the order is image, text, and then bitmap. With HDF_RIGHT the order is bitmap, image and then text.