Advanced Header Control Features

Windows CE enables you to use image lists in header controls, as well in as text and bitmaps. An image list is a collection of images that are all the same size, such as bitmaps or icons. For more information, see Image Lists.

You can use the HDM_SETIMAGELIST message to associate an image list with a header control. Use the HDM_GETIMAGELIST message to retrieve the handle of the image list that is associated with a header control. To display an image with a header control item, specify HDI_IMAGE as the mask member, HDF_IMAGE as the fmt member, and the zero-based index of an image in the list as the iImage member of the HDITEM member structure you use to add the item to the header control.

Header controls in Windows CE support callback requests for text and images in header control items. To create a callback item, set the pszText member to LPSTR_TEXTCALLBACK, or the iImage member to I_IMAGECALLBACK, in the HDITEM structure you fill in when you add the item to the header control. This causes the header control to send the HDN_GETDISPINFO notification message when the item is about to be drawn. The lParam of the WM_NOTIFY message is a pointer to an NMHDDISPINFO structure. When the header control sends the notification, it sets the NMHDDISPINFO structure's members to specify the type of information it needs in order to draw the item. The application returns the requested information to the header control by filling in the appropriate members of the structure. If the application sets the mask member to HDI_DI_SETITEM, the header control stores the information and does not request it again. Otherwise, the header control sends the NMHDDISPINFO notification each time the item is redrawn.

Header controls in Windows CE also support drag-and-drop functionality. To create a header control that supports drag-and-drop operations, specify the HDS_DRAGDROP style when you create the header control. You can also customize a header control's drag-and-drop behavior by handling the HDN_BEGINDRAG and HDN_ENDDRAG notification messages and by sending HDM_CREATEDRAGIMAGE and HDM_SETHOTDIVIDER messages.

In Windows CE, you can support custom ordering of items in a header control by setting the iOrder member in the HDITEM structure when you add an item to a header control, and by using the HDM_GETORDERARRAY, HDM_SETORDERARRAY, and HDM_ORDERTOINDEX messages.

Header controls in Windows CE support the custom draw service, which gives you flexibility to customize a header control's appearance. If a header control provides this service, it sends the NM_CUSTOMDRAW notification at specific times during drawing operations. The lParam of the NM_CUSTOMDRAW notification is a pointer to an NMCUSTOMDRAW structure, which contains the information necessary to draw the customized header control. For information on the custom draw service, see Overview of Controls.