【问题标题】:C++ Windows jumplist classes are not being identified未识别 C++ Windows 跳转列表类
【发布时间】:2014-12-10 22:55:55
【问题描述】:

尝试使用 Visual Studio 2008 构建软件电话源 (microsip),但无法识别 windows 跳转列表类。

第 19 行出现错误,因为 ICustomDestinationList 未被识别

c:\users\gremblin\downloads\microsip-3.9.2-src\microsip-3.9.2-src\jumplist.h(19)
 : error C2143: syntax error : missing ';' before '*'


 1. #ifndef jumplist_h__
 2. #define jumplist_h__
 3. 
 4. #include <string>
 5. #include <shobjidl.h>
 6. #include <propkey.h>
 7. #include <propvarutil.h>
 8. 
 9. class JumpList
10. {
11.  public:
12.   JumpList(std::wstring AppID);
13.   ~JumpList();
14.   bool DeleteJumpList();
15.   void AddTasks();
16.
17.  private:
18.   HRESULT _CreateShellLink(PCWSTR pszArguments, PCWSTR pszTitle, IShellLinkW **ppsl, int iconindex = -1);
19.   ICustomDestinationList *pcdl;
20. };

#endif // jumplist_h__

我错过了什么吗?据我所知jumplist函数都在"shobjidl.h"

【问题讨论】:

    标签: c++ visual-studio-2008 jump-list


    【解决方案1】:

    shobjidl.h 仅在 NTDDI_VERSION &gt;= NTDDI_WIN7 时定义 ICustomDestinationList,因此如果 NTDDI_VERSION 未设置为 Windows 7 或更高版本,编译器会报错。

    NTDDI_VERSION默认定义在sdkddkver.h:

    #define NTDDI_VERSION_FROM_WIN32_WINNT2(ver)    ver##0000
    #define NTDDI_VERSION_FROM_WIN32_WINNT(ver)     NTDDI_VERSION_FROM_WIN32_WINNT2(ver)
    
    ...
    
    #if !defined(_WIN32_WINNT) && !defined(_CHICAGO_)
    #define  _WIN32_WINNT   0x0601
    #endif
    
    #ifndef NTDDI_VERSION
    #ifdef _WIN32_WINNT
    // set NTDDI_VERSION based on _WIN32_WINNT
    #define NTDDI_VERSION   NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
    #else
    #define NTDDI_VERSION   0x06010000
    #endif
    #endif
    

    所以要么在你的项目中自己定义NTDDI_VERSION,要么将_WIN32_WINNT定义为一个合适的值,然后让它传播到NTDDI_VERSION

    请参阅 MSDN,了解 _WIN32_WINNTNTDDI_VERSION 的关系:

    Using Windows Headers

    【讨论】:

      猜你喜欢
      • 2023-04-06
      • 2011-04-19
      • 2011-11-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多