OnCreate
NOTIFYICONDATA nid;
nid.cbSize = (DWORD)sizeof(NOTIFYICONDATA);
nid.hWnd = this->m_hWnd;
nid.uID = IDR_MAINFRAME;
nid.uFlags = NIF_ICON|NIF_MESSAGE|NIF_TIP ;
nid.uCallbackMessage = WM_RIGHT_BOTTOM_NOTIFY;
nid.hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME));
_tcscpy_s(nid.szTip, sizeof(nid.szTip) / sizeof(nid.szTip[0]), _T("成孚电子任务管理系统"));
Shell_NotifyIcon(NIM_ADD,&nid);
OnDestroy
NOTIFYICONDATA nid;
nid.hWnd=this->m_hWnd;
nid.uID=IDR_MAINFRAME;
Shell_NotifyIcon(NIM_DELETE, &nid);
OnSysCommand
if (SC_MINIMIZE == nID)
{
ShowWindow(SW_HIDE);//隐藏主窗口
return;
}