MFC 判断单击双击
1 BOOL CXXXWnd::PreTranslateMessage(MSG* pMsg) 2 { 3 {
pClientPoint = pMsg->pt; 4 MSG message; 5 DWORD st = GetTickCount(); 6 while(1) 7 { 8 if(::PeekMessage(&message, NULL, 0 ,0 , PM_REMOVE)) 9 { 10 ::TranslateMessage(&message); 11 ::DispatchMessage(&message); 12 if(message.message == WM_LBUTTONDBLCLK) 13 { 14 //double cilck 15 break; 16 } 17 DWORD et = GetTickCount(); 18 if(et - st > GetDoubleClickTime()) //GetDoubleClickTime = 500ms 19 { 20 pClientPoint = pMsg->pt; 21 this->ScreenToClient(&pClientPoint); 22 23 if (rectCoord.PtInRect(pClientPoint)) 24 { 25 } 26 else 27 { 28 29 } 30 } 31 break; 32 } 33 } 34 } 35 }