MFC 任务托盘显示气泡

void CTestDlg::OnClose()
{
    ShowWindow(SW_HIDE);

    if (!m_bHideNoticeInfo)
    {
        ShowBalloonTip(_T("程序已最小化到托盘"), _T(""), 3000, 1);
        m_bHideNoticeInfo = true;
    }
}
BOOL CTestDlg::ShowBalloonTip(LPCTSTR szMsg, LPCTSTR szTitle, UINT uTimeout, DWORD dwInfoFlags)
{
    m_nId.uTimeout = uTimeout;
    m_nId.dwInfoFlags = dwInfoFlags;
    strcpy_s(m_nId.szInfo, sizeof(m_nId.szInfo), szMsg ? szMsg : _T(""));
    strcpy_s(m_nId.szInfoTitle, sizeof(m_nId.szInfoTitle), szTitle ? szTitle : _T(""));
    return Shell_NotifyIcon(NIM_MODIFY, &m_nId);
}

 

posted @ 2019-08-10 11:50  高山百川  阅读(917)  评论(1编辑  收藏  举报