/** * Todo * @param void * @param void * @return void */ LRESULT CTrayDialog::OnTrayNotify(WPARAM wParam, LPARAM lParam) { UINT uID; UINT uMsg; uID = (UINT) wParam; uMsg = (UINT) lParam; if (uID != 1) return 0L; CPoint pt; switch (uMsg ) { case WM_MOUSEMOVE: GetCursorPos(&pt); ClientToScreen(&pt); OnTrayMouseMove(pt); break; case WM_LBUTTONDOWN: GetCursorPos(&pt); ClientToScreen(&pt); OnTrayLButtonDown(pt); break; case WM_LBUTTONDBLCLK: GetCursorPos(&pt); ClientToScreen(&pt); OnTrayLButtonDblClk(pt); break; case WM_RBUTTONDOWN: case WM_CONTEXTMENU: GetCursorPos(&pt); //ClientToScreen(&pt); OnTrayRButtonDown(pt); break; case WM_RBUTTONDBLCLK: GetCursorPos(&pt); ClientToScreen(&pt); OnTrayRButtonDblClk(pt); break; default: break; } return 1; }
LRESULT CTrayDialog::OnTrayNotify(WPARAM wParam, LPARAM lParam) { UINT uID = (UINT)wParam; if (uID != 1) return 0; CPoint pt; UINT uMsg = (UINT)lParam; switch (uMsg) { case WM_MOUSEMOVE: GetCursorPos(&pt); ClientToScreen(&pt); OnTrayMouseMove(pt); break; case WM_LBUTTONDOWN: GetCursorPos(&pt); ClientToScreen(&pt); OnTrayLButtonDown(pt); break; case WM_LBUTTONUP: // Handle the WM_LBUTTONUP only if we know that there was also an according // WM_LBUTTONDOWN or WM_LBUTTONDBLCLK on our tray bar icon. If we would handle // WM_LBUTTONUP without checking this, we may get a single WM_LBUTTONUP message // whereby the according WM_LBUTTONDOWN message was meant for some other tray bar // icon. if (m_bLButtonDblClk) { KillSingleClickTimer(); RestoreWindow(); m_bLButtonDblClk = false; } else if (m_bLButtonDown) { if (m_uSingleClickTimer == 0) { if (!IsWindowVisible()) m_uSingleClickTimer = SetTimer(IDT_SINGLE_CLICK, 300, NULL); } m_bLButtonDown = false; } break; case WM_LBUTTONDBLCLK: KillSingleClickTimer(); GetCursorPos(&pt); ClientToScreen(&pt); OnTrayLButtonDblClk(pt); break; case WM_RBUTTONUP: case WM_CONTEXTMENU: KillSingleClickTimer(); GetCursorPos(&pt); //ClientToScreen(&pt); OnTrayRButtonUp(pt); break; case WM_RBUTTONDBLCLK: KillSingleClickTimer(); GetCursorPos(&pt); ClientToScreen(&pt); OnTrayRButtonDblClk(pt); break; } return 1; }