Published Tuesday September 11, 2007
The ListView control uses the Header control to display the header columns. Don’t worry, in our case we are concerned with only two of the several messages that it supports, and I will explain what we will be doing. Here is a quick run-down.
- First we have to get a pointer to the header control using the LVM_GETHEADER message.
- If we are sorting a new column, i.e. previously we sorted by column 1 and now we are sorting by column 2 then we will have to first remove the icon from the previous column (assuming we are only supporting sorting on one column at a time). See the next step on how this is done.
- We set the icon on the new column in three steps.
- Using the HDITEM structure with mask set to HDI_FORMAT and HDM_GETITEM message we will get the current format.
- Append either HDF_SORTUP or HDF_SORTDOWN to the
- Send HDM_SETITEM message to set the new icon.