FlatListCtrl.cpp
资源名称:anywhere.zip [点击查看]
上传用户:zhenhuadz
上传日期:2007-01-07
资源大小:1511k
文件大小:1k
源码类别:
远程控制编程
开发平台:
Visual C++
- / FlatListCtrl.cpp : implementation file
- //
- #include "stdafx.h"
- #include "FlatListCtrl.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CFlatListCtrl
- CFlatListCtrl::CFlatListCtrl()
- {
- }
- CFlatListCtrl::~CFlatListCtrl()
- {
- }
- BEGIN_MESSAGE_MAP(CFlatListCtrl, CListCtrl)
- //{{AFX_MSG_MAP(CFlatListCtrl)
- ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnColumnClick)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CFlatListCtrl message handlers
- void CFlatListCtrl::PreSubclassWindow()
- {
- CListCtrl::PreSubclassWindow();
- VERIFY(m_wndFlatHeader.SubclassWindow(::GetDlgItem(m_hWnd,0)));
- }
- void CFlatListCtrl::OnColumnClick(NMHDR* pNMHDR, LRESULT* pResult)
- {
- NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
- BOOL bSortAscending;
- // If clicked on already sorted column, reverse sort order
- if(pNMListView->iSubItem == m_wndFlatHeader.GetSortColumn(&bSortAscending))
- bSortAscending = !bSortAscending;
- else
- bSortAscending = TRUE;
- m_wndFlatHeader.SetSortColumn(pNMListView->iSubItem, bSortAscending);
- // Do some sort of sorting...
- *pResult = 0;
- }