C ++ Windows跳转列表类未标识 [英] C++ Windows jumplist classes are not being identified

查看:209
本文介绍了C ++ Windows跳转列表类未标识的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用Visual Studio 2008构建软件电话源(microsip),但是没有标识Windows跳转列表类。



第19行显示错误,因为 ICustomDestinationList 无法识别

  c:\users\gremblin\下载\microsip-3.9.2-src \microsip-3.9.2-src\jumplist.h(19)
:错误C2143:语法错误:缺少';'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.类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__

我错过了什么?据我所知跳转列表函数都在shobjidl.h


< 只有当定义 ICustomDestinationList 时,才会执行

code> NTDDI_VERSION> = NTDDI_WIN7 ,因此如果 NTDDI_VERSION 未设置为Windows 7或更高版本,编译器会提示。



默认情况下在 sdkddkver.h 中定义NTDDI_VERSION p>

  #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
//根据_WIN32_WINNT $ b设置NTDDI_VERSION $ b #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_WINNT 涉及 NTDDI_VERSION



使用Windows标题


Trying to build a softphone source (microsip) with Visual Studio 2008, but the windows jumplist classes are not being identified.

Line 19 gives an error because ICustomDestinationList is not being recognized

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__

Am I missing something? As far as I know jumplist functions are all in "shobjidl.h"

解决方案

shobjidl.h defines ICustomDestinationList only when NTDDI_VERSION >= NTDDI_WIN7, so the compiler will complain if NTDDI_VERSION is not set to Windows 7 or higher.

NTDDI_VERSION is defined by default in 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

So either define NTDDI_VERSION yourself in your project, or define _WIN32_WINNT to an appropriate value and let it propagate to NTDDI_VERSION.

Refer to MSDN for how _WIN32_WINNT relates to NTDDI_VERSION:

Using Windows Headers

这篇关于C ++ Windows跳转列表类未标识的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆