I found the answer, what I had, copied the justifymask from the column clicked. This version copies each column separately.
void CFindWhatDlg::SetSortIcon()
{
ASSERT(m_list);
CHeaderCtrl* pHeaderCtrl = m_list.GetHeaderCtrl();
ASSERT(pHeaderCtrl);
HDITEM hdrItem;
for (int nCol = 0; nCol < pHeaderCtrl->GetItemCount(); nCol++)
{
hdrItem.mask = HDI_FORMAT | HDI_IMAGE;
pHeaderCtrl->GetItem(nCol, &hdrItem);
if(bAscending)
{
hdrItem.iImage = m_nUpArrow;
hdrItem.fmt = hdrItem.fmt & HDF_JUSTIFYMASK |
HDF_IMAGE | HDF_STRING| HDF_BITMAP_ON_RIGHT;
}
else
{
hdrItem.iImage = m_nDownArrow;
hdrItem.fmt = hdrItem.fmt & HDF_JUSTIFYMASK |
HDF_IMAGE | HDF_STRING| HDF_BITMAP_ON_RIGHT;
}
pHeaderCtrl->SetItem(nCol, &hdrItem);
}
}