读书人

急头文件编译有关问题

发布时间: 2012-02-02 23:57:14 作者: rapoo

急!头文件编译问题。
急!为什么在两种不同的工程下(分别是MFC Wizard(exe)和Win32 Application)下编译同一个shellapi.h头文件结果却不一样呢?在MFC Wizard(exe)下编译可以通过,而在Win32 Application 下编译却通不过。
D:\Work\IVTalk\ChatClient\ChatClient\Mainfrm.cpp(2381) : error C2039: 'dwInfoFlags ' : is not a member of '_NOTIFYICONDATAA '
F:\SOFTWARE\PSDK\INCLUDE\shellapi.h(500) : see declaration of '_NOTIFYICONDATAA '
D:\Work\IVTalk\ChatClient\ChatClient\Mainfrm.cpp(2381) : error C2065: 'NIIF_INFO ' : undeclared identifier
D:\Work\IVTalk\ChatClient\ChatClient\Mainfrm.cpp(2383) : error C2039: 'szInfoTitle ' : is not a member of '_NOTIFYICONDATAA '
F:\SOFTWARE\PSDK\INCLUDE\shellapi.h(500) : see declaration of '_NOTIFYICONDATAA '
D:\Work\IVTalk\ChatClient\ChatClient\Mainfrm.cpp(2384) : error C2039: 'szInfo ' : is not a member of '_NOTIFYICONDATAA '
F:\SOFTWARE\PSDK\INCLUDE\shellapi.h(500) : see declaration of '_NOTIFYICONDATAA '


[解决办法]
API版本设置问题,类似:

// 如果您必须使用下列所指定的平台之前的平台,则修改下面的定义。
// 有关不同平台的相应值的最新信息,请参考 MSDN。
#ifndef WINVER// 允许使用 Windows 95 和 Windows NT 4 或更高版本的特定功能。
#define WINVER 0x0400//为 Windows98 和 Windows 2000 及更新版本改变为适当的值。
#endif

#ifndef _WIN32_WINNT// 允许使用 Windows NT 4 或更高版本的特定功能。
#define _WIN32_WINNT 0x0400//为 Windows98 和 Windows 2000 及更新版本改变为适当的值。
#endif

#ifndef _WIN32_WINDOWS// 允许使用 Windows 98 或更高版本的特定功能。
#define _WIN32_WINDOWS 0x0410 //为 Windows Me 及更新版本改变为适当的值。
#endif

#ifndef _WIN32_IE// 允许使用 IE 4.0 或更高版本的特定功能。
#define _WIN32_IE 0x0400//为 IE 5.0 及更新版本改变为适当的值。
#endif

读书人网 >VC/MFC

热点推荐