在窗体函数里向空间ListView发消息,让它根据指定列排序
-----WM_NOTIFY消息是控件发向窗体的,MFC窗体再向空间反射部分消息,让空间自己处理
BOOL ClickListColumn(CListCtrl& listCtrl, int index)
{
if(index >= listCtrl.GetHeaderCtrl()->GetItemCount())
return FALSE;
NM_LISTVIEW nmListView;
memset(&nmListView, 0, sizeof(nmListView));
nmListView.iItem = -1;//NOT USED IN HERE
nmListView.iSubItem = index;//INDEX VALUE
nmListView.hdr.hwndFrom = listCtrl.GetSafeHwnd();
nmListView.hdr.idFrom = listCtrl.GetDlgCtrlID();
nmListView.hdr.code = LVN_COLUMNCLICK;
return SendMessage(WM_NOTIFY, listCtrl.GetDlgCtrlID(), (LPARAM)&nmListView);
}