Help us understand the problem. What is going on with this article?

WINVER, _WIN32_WINNT の設定値

More than 3 years have passed since last update.

targetver.h に定義する、WindowsAPIバージョン設定値の一覧表です。

https://msdn.microsoft.com/en-us/library/aa383745(VS.85).aspx
https://msdn.microsoft.com/library/windows/desktop/aa383745
https://msdn.microsoft.com/library/6sehtctf.aspx
http://stackoverflow.com/questions/34235151/get-windows-version
より

バージョン定数一覧

_WIN32_WINNT と WINVER への設定値一覧

Minimum system required Minimum value for _WIN32_WINNT and WINVER
Windows 10 _WIN32_WINNT_WIN10 (0x0A00)
Windows 8.1 _WIN32_WINNT_WINBLUE (0x0603)
Windows 8 _WIN32_WINNT_WIN8 (0x0602)
Windows 7 _WIN32_WINNT_WIN7 (0x0601)
Windows Server 2008 _WIN32_WINNT_WS08 (0x0600)
Windows Vista _WIN32_WINNT_VISTA (0x0600)
Windows Server 2003 with SP1, Windows XP with SP2 _WIN32_WINNT_WS03 (0x0502)
Windows Server 2003, Windows XP _WIN32_WINNT_WINXP (0x0501)
Windows 2000 _WIN32_WINNT_WIN2K (0x0500)
Windows NT 4.0 _WIN32_WINNT_NT4 (0x0400)

_WIN32_IE への設定値一覧

Minimum version required Minimum value of _WIN32_IE
Internet Explorer 10.0 _WIN32_IE_IE100 (0x0A00)
Internet Explorer 9.0 _WIN32_IE_IE90 (0x0900)
Internet Explorer 8.0 _WIN32_IE_IE80 (0x0800)
Internet Explorer 7.0 _WIN32_IE_IE70 (0x0700)
Internet Explorer 6.0 SP2 _WIN32_IE_IE60SP2 (0x0603)
Internet Explorer 6.0 SP1 _WIN32_IE_IE60SP1 (0x0601)
Internet Explorer 6.0 _WIN32_IE_IE60 (0x0600)
Internet Explorer 5.5 _WIN32_IE_IE55 (0x0550)
Internet Explorer 5.01 _WIN32_IE_IE501 (0x0501)
Internet Explorer 5.0, 5.0a, 5.0b _WIN32_IE_IE50 (0x0500)

_WIN32_WINNT を設定すれば、sdkddkver.h にて残りのバージョン定数 WINVER,_WIN32_IE を設定してくれる。 下記に、そのコードを抜粋する。

VS2015 の Windows Kits\8.1\Include\shared\sdkddkver.h から抜粋

sdkddkver.h
#define _WIN32_WINNT_NT4                    0x0400
#define _WIN32_WINNT_WIN2K                  0x0500
#define _WIN32_WINNT_WINXP                  0x0501
#define _WIN32_WINNT_WS03                   0x0502
#define _WIN32_WINNT_WIN6                   0x0600
#define _WIN32_WINNT_VISTA                  0x0600
#define _WIN32_WINNT_WS08                   0x0600
#define _WIN32_WINNT_LONGHORN               0x0600
#define _WIN32_WINNT_WIN7                   0x0601
#define _WIN32_WINNT_WIN8                   0x0602
#define _WIN32_WINNT_WINBLUE                0x0603

#ifndef WINVER
  #ifdef _WIN32_WINNT
    // set WINVER based on _WIN32_WINNT
    #define WINVER          _WIN32_WINNT
  #else
    #define WINVER          0x0603
  #endif
#endif

#ifndef _WIN32_IE
  #ifdef _WIN32_WINNT
    // set _WIN32_IE based on _WIN32_WINNT
    #if (_WIN32_WINNT <= _WIN32_WINNT_NT4)
      #define _WIN32_IE       _WIN32_IE_IE50
    #elif (_WIN32_WINNT <= _WIN32_WINNT_WIN2K)
      #define _WIN32_IE       _WIN32_IE_IE501
    #elif (_WIN32_WINNT <= _WIN32_WINNT_WINXP)
      #define _WIN32_IE       _WIN32_IE_IE60
    #elif (_WIN32_WINNT <= _WIN32_WINNT_WS03)
      #define _WIN32_IE       _WIN32_IE_WS03
    #elif (_WIN32_WINNT <= _WIN32_WINNT_VISTA)
      #define _WIN32_IE       _WIN32_IE_LONGHORN
    #elif (_WIN32_WINNT <= _WIN32_WINNT_WIN7)
      #define _WIN32_IE       _WIN32_IE_WIN7
    #elif (_WIN32_WINNT <= _WIN32_WINNT_WIN8)
      #define _WIN32_IE       _WIN32_IE_WIN8
    #else
      #define _WIN32_IE       0x0A00
    #endif
  #else
    #define _WIN32_IE       0x0A00
  #endif
#endif

ビルド時に定数内容を確認するためのコード片

checkver.h
#if 1 // check WINVER,_WIN32_*.
  #define STRING2(x) #x
  #define STRING(x) STRING2(x)
  #pragma message("WINVER        : " STRING(WINVER))
  #pragma message("_WIN32_WINNT  : " STRING(_WIN32_WINNT))
//  #pragma message("_WIN32_WINDOWS: " STRING(_WIN32_WINDOWS)) // Windows9x only
  #pragma message("_WIN32_IE     : " STRING(_WIN32_IE))
#endif

_MSC_VER

こちらを参照
http://qiita.com/yumetodo/items/8c112fca0a8e6b47072d

hkuno
ソフトウェア設計開発者。C/C++をメインにC#, Perl, JavaScript,lua,golangを少々。 最近は、Raspberry Pi で面白いモノを作りたいと思っています。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした