(转)如何在任务栏添加托盘图标
1、在头文件定义
NOTIFYICONDATA m_IconData;
2、BOOL CXXDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_IconData.cbSize=sizeof(NOTIFYICONDATA);
m_IconData.hIcon=m_hIcon;//图标句柄
m_IconData.hWnd=this->GetSafeHwnd();
lstrcpy(m_IconData.szTip,_T("欢迎来访东东博客"));
m_IconData.uFlags=NIF_ICON|NIF_TIP;
Shell_NotifyIcon(NIM_ADD,&m_IconData); //增加托盘图标
return TRUE;
}
//添加关闭消息,将图标从任务栏删除
3、void CXXDlg::OnClose()
{
Shell_NotifyIcon(NIM_DELETE,&m_IconData); //对话框关闭的时候删除托盘图标
CDialog::OnClose();
}
转自:http://blog.csdn.net/jiangdong2007/article/details/12908841