// UDPListCtrl.cpp : implementation file // #include "stdafx.h" #include "UDPListCtrl.h" #include "UDPAdminTool.h" #include "DeviceInformation.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CUDPListCtrl CUDPListCtrl::CUDPListCtrl() { } CUDPListCtrl::~CUDPListCtrl() { } BEGIN_MESSAGE_MAP(CUDPListCtrl, CListCtrl) //{{AFX_MSG_MAP(CUDPListCtrl) ON_WM_LBUTTONDBLCLK() ON_WM_LBUTTONDOWN() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CUDPListCtrl message handlers BOOL CUDPListCtrl::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) { // TODO: Add your specialized code here and/or call the base class dwStyle = dwStyle | LVS_NOCOLUMNHEADER; return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext); } void CUDPListCtrl::PrepareControl(WORD wStyle) { m_wStyle = wStyle; ASSERT(m_hWnd); DWORD dwStyle = GetWindowLong(m_hWnd, GWL_STYLE); dwStyle &= ~(LVS_TYPEMASK); dwStyle &= ~(LVS_EDITLABELS); SetWindowLong(m_hWnd, GWL_STYLE, dwStyle | LVS_REPORT); DWORD styles = LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP ; ListView_SetExtendedListViewStyleEx(m_hWnd, styles, styles ); } void CUDPListCtrl::SetWnd(HWND m_DlgWnd) { m_pWnd = m_DlgWnd; } void CUDPListCtrl::OnLButtonDblClk(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default LVHITTESTINFO ht; ht.pt = point; int rval = ListView_SubItemHitTest(m_hWnd, &ht); if(rval != -1) { theApp.m_iNowDevice = rval; // ::SendMessage(m_pWnd, WM_DEVICE_SELECT , rval, 0); CDeviceInformation pDI; pDI.DoModal(); } CListCtrl::OnLButtonDblClk(nFlags, point); } void CUDPListCtrl::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default LVHITTESTINFO ht; ht.pt = point; int rval = ListView_SubItemHitTest(m_hWnd, &ht); if(rval != -1) { theApp.m_iNowDevice = rval; } CListCtrl::OnLButtonDown(nFlags, point); }