Thanks Richard. That was my understanding of the documentation too, but it wasn't working in my code and I couldn't figure out why. But after a bunch of experiments I think I've got it sorted.
There were two problems.
First:
To detect mouse clicks in the header, the list control apparently has to have the LVS_NOSORTHEADER style set FALSE. I don't want sorting, so I had set it to TRUE in the dialog editor properties section, which seemed reasonable, but this seems to stop the mouse click generating the LVN_COLUMNCLICK message at all.
Once I set the property FALSE, I was able to pick up the message in the parent dialog as per the documentation, with the handler as in my original problem post.
However, this ONLY works with a CListCtrl, not with a CMFCListCtrl. I preferred the latter because it generates a nicer default colour for the header (at least with my system).
Second:
Examination of the CMFCListCtrl source code in afxlistctrl.cpp showed that it traps LVN_COLUMNCLICK in a NotifyRefect handler, which then calls the virtual sort code
ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, &CMFCListCtrl::OnColumnClick)
.
The Reflect part means that the message does not propagate to the parent dialog, which was why I didn't pick it up there. I was able to get round this by subclassing CMFCListCtrl, and handling the message in my version of the control. This responds to mouse clicks in the header, and I could then activate the mechanism for changing its text, which was my original aim. The reason it didn't work in my first attempt at subclassing was the styles problem described in First above.