Header Control
The header control is what is seen on the top of a lists in report (details) mode. Usually programs do not create header controls directly but only uses the one managed automatically by the listview. They may however send messages directly to the control after obtaining a handle with LVM_GETHEADER. Most of the header notifies are forwarded by the listview to the application.
A header control in a listview
Current status
The control is rather complete. It is missing:
- Filter support. I currently don't know any application using it. However I think I've seen it on a screenshot of Windows Vista Explorer so this may change quickly.
- Windows Vista adds some new messages (but a few)
There are some known bugs but I don't think they affect applications:
- If the application returns TRUE to HDN_TRACKING the tracking should stop tracking and not modify the width. Note that in our days most headers are HDS_FULLDRAG - when dragging the divider they resize the header item after each mouse move and don't send HDN_TRACKING.
- Probably it would be better if the control only released the capture on LButtonUp and did most of the work on WM_CAPTURECHANGED - that way it would work if another control would take the capture.
There are also some limitations in the listview that limits the header:
- Listview doesn't support column reordering. It responds TRUE to HDN_ENDDRAG to block the header items reorder.
- The listview forwards most header notifications to it's owner. It requests the notification to be Unicode (as on Windows) but it should convert them to ANSI if needed.
Things not found on the MSDN
- During a HDM_INSERTITEM the width, format, lParam are copied even if not in the mask (that doesn't apply to HDM_SETITEM). Also some format bits are automatically set - e.g. HDF_BITMAP if hbm is non-zero.
- In NMHDDISPINFO the lParam is set by the control. Even if the handler changes this value, the change is ignored. I've never seen the HDI_LPARAM flag set in the mask.
