C++ Windows jumplist classes are not being identified

667 views Asked by At

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"

1

There are 1 answers

0
Remy Lebeau On

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