如何处理通知(Shell_NotifyIcon)以便在用户单击它时执行某些操作?

时间:2013-11-13 09:22:05

标签: notifications tooltip trayicon popup-balloons balloon-tip

Iam NewBie,我为我的应用程序创建了托盘图标 与

 void createTrayIcon(LpSTR msg)
 {
  memset(&m_NID, 0 , sizeof(m_NID));

m_NID.cbSize = sizeof(m_NID);

// set tray icon ID
m_NID.uID = ID_SYSTEMTRAY  ;


// set handle to the window that receives tray icon notifications
ASSERT(::IsWindow(GetSafeHwnd()));
m_NID.hWnd = GetSafeHwnd();

// set message that will be sent from tray icon to the window  
m_NID.uCallbackMessage = WM_TRAYICON_EVENT;

StringCchCopy(m_NID.szInfo, ARRAYSIZE(m_NID.szTip),msg);
StringCchCopy(m_NID.szInfoTitle, ARRAYSIZE(m_NID.szInfoTitle), L"DuOS");

// fields that are being set when adding tray icon
m_NID.uFlags = NIF_MESSAGE|NIF_ICON|NIF_INFO;   

// set image
m_NID.hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);

if(!m_NID.hIcon)
    return FALSE;

return Shell_NotifyIcon(NIM_ADD, &m_NID);

}

我正在使用

显示通知
Shell_NotifyIcon(NIM_MODIFY , &m_NID);
My problem is I want to handle that Notification i.e, If user clicks on that
Notification I need to do some action, How to achieve this

我正在尝试这个过去两天我用Google搜索了很多次并搜索了很多博客但是我不能,任何人都请帮帮我

1 个答案:

答案 0 :(得分:1)

最后我得到了答案,

有一个 NIN_BALOONUSERCLICK 标志,如果用户点击Baloon,它将返回此标志...