如何屏蔽CListCtrl控件的右鍵選上記錄的功能?
熱心網友
you can filter out right button message of CListCtrl in PreTranslateMessage, eg BOOL CuseflashDlg::PreTranslateMessage(MSG* pMsg) { // change right button message to left button message by masterz POINT pt; pt。x = LOWORD(pMsg-lParam); pt。y= HIWORD(pMsg-lParam); CString msg; CRect rc; m_flash。GetWindowRect(&rc); ScreenToClient(&rc); msg。Format("mouse (%d,%d),flash (%d,%d,%d,%d)",pt。x,pt。y,rc。left, p,rc。right, ttom); if(pMsg-message==WM_RBUTTONDOWN ¦ ¦pMsg-message==WM_RBUTTONUP ¦ ¦pMsg-message==WM_RBUTTONDBLCLK) OutputDebugString(msg); if(rc。PtInRect(pt) ¦ ¦::GetFocus()==m_flash。m_hWnd ¦ ¦pMsg-hwnd==m_flash。m_hWnd) //if(::GetFocus()==m_flash。m_hWnd) { if(pMsg-message==WM_RBUTTONDOWN) pMsg-message=WM_LBUTTONDOWN; if(WM_RBUTTONUP==pMsg-message) pMsg-message = WM_LBUTTONUP; if(WM_RBUTTONDBLCLK==pMsg-message) pMsg-message=WM_LBUTTONDBLCLK; if(pMsg-message==WM_RBUTTONDOWN ¦ ¦pMsg-message==WM_RBUTTONUP ¦ ¦pMsg-message==WM_RBUTTONDBLCLK) OutputDebugString("point in rect"); } return CDialog::PreTranslateMessage(pMsg); } 。