'IContextMenu' : no GUID has been associated with this object问题的解决
作者:朱金灿
来源:http://blog.****.net/clever101
在Win XP环境下使用VS 2005编译一个shell扩展工程,出现一些编译错误:
error C2787: 'IContextMenu ' :no GUID hasbeen associated withthis object
error C2440: 'initializing ' :cannot convert from'DWORD_PTR ' to 'constIID * '
error C2440: 'initializing ' :cannot convert from'ATL::_ATL_CREATORARGFUNC(__stdcall *) ' to'DWORD_PTR '
搜了一些资料,发现问题在于VS 2005的comdef.h并没有包含IContextMenu,而且VS2005的comdef.h只在VC的include下有,Platform SDK下的include并没有这个问题,所以调整头文件的包含顺序是不能解决这个问题的。
要解决这个问题,需要更新Windows PlatformSDK,具体可以更新到这个版本:
Windows®Server 2003 R2 Platform SDK ISO Download
安装该版本后,单击菜单:Register PSDKDirectorues with visual studio,即可把WindowsPlatform SDK的头文件和库文件包含进VS 2005,具体如下图: