BOOL CUpdateDlg::ShowBalloonTip(LPCTSTR szMsg, LPCTSTR szTitle, UINT uTimeout, DWORD dwInfoFlags){m_nid.cbSize=sizeof(NOTIFYICONDATA);m_nid.uFlags = NIF_INFO;m_nid.uTimeout = uTimeout;//10s~30s之间,不过好像无效,所以设置个Timer隐藏m_nid.dwInfoFlags = dwInfoFlags;strcpy(m_nid.szInfo,szMsg ? szMsg : _T(""));strcpy(m_nid.szInfoTitle,szTitle ? szTitle : _T(""));BOOL bRet=Shell_NotifyIcon(NIM_MODIFY, &m_nid);//如果前面已经设置过这个Timer,则会重新开始计时SetTimer(WM_TIMER_HIDEBALLOON,uTimeout,NULL);return bRet;}void CUpdateDlg::OnTimer(UINT nIDEvent) {// TODO: Add your message handler code here and/or call defaultswitch (nIDEvent){ case WM_TIMER_HIDEBALLOON: m_nid.uFlags=NIF_INFO; strcpy(m_nid.szInfo,_T("")); strcpy(m_nid.szInfoTitle,_T("")); Shell_NotifyIcon(NIM_MODIFY, &m_nid); KillTimer(WM_TIMER_HIDEBALLOON); break; default : break;}CDialog::OnTimer(nIDEvent);}