系统托盘的使用
网上找到段代码,是个系统托盘使用示例://add icon in the system bar
int CDialogExampleDlg::TaskBarAddIcon(HWND hwnd,UINT uID,HICON hicon, LPSTR lpszTip)
{
BOOL res;
NOTIFYICONDATA nid;
nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = hwnd;
nid.uID = uID;
nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
nid.uCallbackMessage = WM_TRAYICONCLICK;
nid.hIcon = hicon;
if (lpszTip)
lstrcpyn(nid.szTip, lpszTip, sizeof(nid.szTip));
else
nid.szTip[0] = '\0';
res = Shell_NotifyIcon(NIM_ADD, &nid);
if (hicon)
DestroyIcon(hicon);
return res;
}
//delete icon in the system bar
int CDialogExampleDlg::TaskBarDeleteIcon(HWND hwnd,UINT uID)
{
BOOL res;
NOTIFYICONDATA tnid;
tnid.cbSize = sizeof(NOTIFYICONDATA);
tnid.hWnd = hwnd;
tnid.uID = uID;
res = Shell_NotifyIcon(NIM_DELETE, &tnid);
return res;
}
但是我加到程序钟后发现有个错误
error C2065: 'WM_TRAYICONCLICK' : undeclared identifier
难道这个 WM_TRAYICONCLICK 是自定义的一个名称吗 ?