All project created with MSVC have stdafx, which is precompiled headers, which I know what they are but what about targetver.h ? It includes SDKDDKVer.h, and I can't find what is that header about.
What is this for ?
All project created with MSVC have stdafx, which is precompiled headers, which I know what they are but what about targetver.h ? It includes SDKDDKVer.h, and I can't find what is that header about.
What is this for ?
targetver.h
andSDKDDKVer.h
are used to control what functions, constants, etc. are included into your code from the Windows headers, based on the OS that you want your program to support. I believe thattargetver.h
sets defaults to using the latest version of Windows unless the defines are specified elsewhere.SDKDDKVer.h
is the header file that actually defines the#defines
that represent each version of Windows, IE, etc.Line 193 of the
SDKDDKVer.h
(in SDK 8.1) states:"if versions aren't already defined, default to most current"
This comment is specifically referring to the
_WIN32_WINNT
andNTDDI_VERSION
macros.So..
SDKDDKVer.h
applies default values unless the macros have already been defined#define _WIN32_WINNT 0x0601
#define NTDDI_VERSION 0x06010000
SDKDDKVer.h
header file has 'constant' values defined for all of the SDK versions. For example:#define _WIN32_WINNT_WINXP 0x0501
#define _WIN32_WINNT_WIN7 0x0601
#define _WIN32_WINNT_WIN8 0x0602
_WIN32_WINNT
andNTDDI_VERSION
in a header file calledTargetVer.h
, which you would reference in your pre-compiled headerStdAfx.h
.ADDTIONAL READING