Q:實現IContextMenu出現C2787錯誤:“IContextMenu”:沒有與該對象關聯的GUID

From: http://community.csdn.net/expert/Topicview2.asp?id=4853965

A:There are two <comdef.h> header files in VC.NET, one in Vc7/include and the other in Vc7/PlatformSDK/include. The former splits off the smart pointer typedefs into comdefsp.h, and it doesn't include IContextMenu. The latter does. You can try to #include the PlatformSDK header directly, change your INCLUDE path order, or supply the missing typedef yourself, e.g.

struct __declspec(uuid("000214e4-0000-0000-c000-000000000046"))
IContextMenu;


_COM_SMARTPTR_TYPEDEF(IContextMenu, __uuidof(IContextMenu)); 
 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章