void CTrayIcon::OnTimer( UINT_PTR nIDEvent ) { if ( nIDEvent == _defFlashIconTimerID ) { if ( m_IsShowIcon ) { FlashIconData Data = DecideFlashIconData(); CIcon icon; icon.LoadIcon(Data.nIconNormal); ChangeIcon(icon); ChangeToolTip(Data.strTooltip); m_IsShowIcon = false; } else { FlashIconData Data = DecideFlashIconData(); CIcon icon; icon.LoadIcon(Data.nIconFlash); ChangeIcon(icon); ChangeToolTip(Data.strTooltip); m_IsShowIcon = true; } } else if ( nIDEvent == _defIconLeaveTimerID ) { POINT pt = {0}; RECT rc; GetCursorPos(&pt); if ( GetTrayIconRect(FindTrayWnd(), m_hNotifyWnd, &rc) == S_FALSE) { GetTrayIconRect(FindNotifyIconOverflowWindow(), m_hNotifyWnd, &rc); } if ( !PtInRect(&rc,pt) ) { BOOL b; OnTrayIconNotify(WM_TRAYICONNOTIFY, 0, WM_MOUSELEAVE, b); } } }
LRESULT MainDialog::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { if (WM_NCLBUTTONDBLCLK == uMsg)//禁用双击标题栏最大化 { return 0; } else if (WM_TRAYICON_NOTIFY == uMsg) { OnTrayIconNotify(wParam, lParam); return 0; } else if (WM_TIMER == uMsg) { if (wParam == TIMER_TRAYEMOT) { static BOOL bTrans = FALSE; if (bTrans) { bTrans = FALSE; SetTrayIconIndex(ICON_TRAY_LOGO); } else { bTrans = TRUE; SetTrayIconIndex(-1); } } } else if (WM_ENDSESSION == uMsg) { BOOL bEnding = wParam; if (!bEnding) return 0; module::getMiscModule()->quitTheApplication(); APP_LOG(LOG_INFO, _T("MainDialog: WM_ENDSESSION System End Session OK")); } return WindowImplBase::HandleMessage(uMsg, wParam, lParam); }
LRESULT MainDialog::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { //禁用双击标题栏最大化 if (WM_NCLBUTTONDBLCLK == uMsg) { return 0; } else if (WM_HOTKEY == uMsg) { OnHotkey(wParam, lParam); return 0; } else if (WM_TRAYICON_NOTIFY == uMsg) { OnTrayIconNotify(wParam, lParam); return 0; } else if (WM_MENU_NOTIFY == uMsg) { LPCTSTR pName = (LPCTSTR)wParam; LPCTSTR pSid = (LPCTSTR)lParam; if (pName) { //LOG__(APP, _T("WM_MENU_NOTIFY:%s"),pName); OnMenuClicked(CString(pName), CString(pSid)); } return 0; } else if (WM_TIMER == uMsg) { if (wParam == TIMER_TRAYEMOT) { static BOOL bTrans = FALSE; if (bTrans) { bTrans = FALSE; SetTrayIconIndex(ICON_TRAY_LOGO); } else { bTrans = TRUE; SetTrayIconIndex(-1); } } } else if (WM_ENDSESSION == uMsg) { BOOL bEnding = wParam; if (!bEnding) return 0; module::getMiscModule()->quitTheApplication(); LOG__(APP, _T("MainDialog: WM_ENDSESSION System End Session OK")); } else if (WM_COPYDATA == uMsg) { COPYDATASTRUCT *pCopyData = (COPYDATASTRUCT*)lParam; OnCopyData(pCopyData); } return WindowImplBase::HandleMessage(uMsg, wParam, lParam); }