Note that several members of this structure are only supported for Shell32.dll versions 5.0 and later. To enable these members, include one of the following in your header: #define _WIN32_IE 0x0500 #define _WIN32_IE 0x0600
a tip:#define _WIN32_IE 0x0500 #define _WIN32_IE 0x0600should before #include <afxwin.h> at stdafx.h
DWORD cbSize;
HWND hWnd;
UINT uID;
UINT uFlags;
UINT uCallbackMessage;
HICON hIcon;
TCHAR szTip[64];
DWORD dwState;
DWORD dwStateMask;
TCHAR szInfo[256];
union {
UINT uTimeout;
UINT uVersion;
};
TCHAR szInfoTitle[64];
DWORD dwInfoFlags;
GUID guidItem;
} NOTIFYICONDATA, *PNOTIFYICONDATA;
Structure InformationHeader shellapi.h
Minimum operating systems Windows NT 4.0, Windows 95
#define _WIN32_IE 0x0600
#define _WIN32_IE 0x0600should before #include <afxwin.h> at stdafx.h
我知道,上面的就是最新的NOTIFYICONDATA结构,而且我在stdafx.h头文件里面也加了
#ifndef _WIN32_IE
#define _WIN32_IE 0x0500
#endif
但程序调用的确还是老的shellapi里面的NOTIFYICONDATA结构
不晓得是怎么回事.
说NOTIFYICONDATA没有定义dwInfoFlags,uTimeout这些变量
m_nData.cbSize=sizeof(NOTIFYICONDATA);
m_nData.hWnd=GetSafeHwnd();
m_nData.uFlags=NIF_MESSAGE|NIF_INFO|NIF_ICON;
m_nData.uCallbackMessage=MYWM_NOTIFYICON;
m_nData.uID=IDR_MAINFRAME;
m_nData.hIcon=AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_nData.dwInfoFlags=NIIF_INFO;
_tcscpy(m_nData.szInfoTitle,"title");
_tcscpy(m_nData.szInfo,"tip text");
Shell_NotifyIcon(NIM_ADD,&m_nData);
DWORD cbSize;
HWND hWnd;
UINT uID;
UINT uFlags;
UINT uCallbackMessage;
HICON hIcon;
#if (_WIN32_IE < 0x0500)
WCHAR szTip[64];
#else
WCHAR szTip[128];
#endif
#if (_WIN32_IE >= 0x0500)
DWORD dwState;
DWORD dwStateMask;
WCHAR szInfo[256];
union {
UINT uTimeout;
UINT uVersion;
} DUMMYUNIONNAME;
WCHAR szInfoTitle[64];
DWORD dwInfoFlags;
#endif
} NOTIFYICONDATA, *PNOTIFYICONDATA;
shellapi.h 和shell32.lib要一致
谢谢各位了!