清泛IT社区

标题: 怎样用SendMessage发送LVN_COLUMNCLICK消息? [打印本页]

作者: 清泛网    时间: 2016-05-17 11:44
标题: 怎样用SendMessage发送LVN_COLUMNCLICK消息?
SendMessage(WM_NOTIFY, CtrlID, NM_LISTVIEW);

部分代码示例如下:
  1. BOOL ClickListColumn(CListCtrl& listCtrl, int index)
  2. {
  3.         if(index >= listCtrl.GetHeaderCtrl()->GetItemCount())
  4.             return FALSE;

  5.         NM_LISTVIEW nmListView;
  6.         memset(&nmListView, 0, sizeof(nmListView));
  7.         nmListView.iItem = -1;//NOT USED IN HERE
  8.         nmListView.iSubItem = index;//INDEX VALUE
  9.         nmListView.hdr.hwndFrom = listCtrl.GetSafeHwnd();
  10.         nmListView.hdr.idFrom = listCtrl.GetDlgCtrlID();
  11.         nmListView.hdr.code = LVN_COLUMNCLICK;

  12.         return SendMessage(WM_NOTIFY, listCtrl.GetDlgCtrlID(), (LPARAM)&nmListView);
  13. }
复制代码







欢迎光临 清泛IT社区 (https://bbs.tsingfun.com/) Powered by Discuz! X3.3