How can i determine the version of the Windows SDK

2019-02-16 03:43发布

I've very recently decided to teach myself c++ and win32 programming after learning vb.net, and I've got a very simple question:

How can I determine what version of the Windows SDK is installed on my computer?

I'm asking so I can install the latest version if it isn't installed already, before I start playing around with c++. I'm using Microsoft Visual Studio 2008 SP1 as my IDE.

4条回答
虎瘦雄心在
2楼-- · 2019-02-16 04:40

On English locale at least:

dir "%ProgramFiles%\Microsoft SDKs\Windows"

should work. It is quite likely that there will be multiple versions installed, which is the right one for an one build can only be specified by that project.

查看更多
Bombasti
3楼-- · 2019-02-16 04:43

For latest versions, check under this regedit key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits

or under:

C:\Program Files (x86)\Microsoft SDKs\Windows Kits
查看更多
你好瞎i
4楼-- · 2019-02-16 04:44

The current version of the Windows SDK is stored in the CurrentVersion value of the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows CurrentVersion

and it can be retrieved using this PowerShell one-liner:

$(Get-Item "hklm:\SOFTWARE\Microsoft\Microsoft SDKs\Windows").GetValue("CurrentVersion")

enter image description here

查看更多
爷、活的狠高调
5楼-- · 2019-02-16 04:46

If you need to determine, while compiling, what version of the Windows SDK is being used then you can use the VER_PRODUCTBUILD macro, which is defined in ntverp.h. For instance:

#include <ntverp.h>
#if VER_PRODUCTBUILD > 9600
// Windows 10+ SDK code goes here
#else
// Windows 8.1- SDK code goes here
#endif

In most cases this should not be necessary because a product should be designed to build with a particular platform SDK. But for some large products there may be a desired to support multiple platform SDKs. This can be particularly useful when migrating from one to another. If there is a bug in a header file (such as the bogus "#pragma pop" in the Windows 8.1 SDK version of bthledef.h) then you may need to workaround this bug, but not include the workaround when using the Windows 10 SDK or higher.

查看更多
登录 后发表回答