11
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

WINVER, _WIN32_WINNT の設定値

Last updated at Posted at 2016-09-05

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 を設定してくれる。 下記に、そのコードを抜粋する。

VS2019 の Windows Kits\10\Include\10.0.18362.0\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
#define _WIN32_WINNT_WINTHRESHOLD           0x0A00 /* ABRACADABRA_THRESHOLD*/
#define _WIN32_WINNT_WIN10                  0x0A00 /* ABRACADABRA_THRESHOLD*/

#ifndef WINVER
#ifdef _WIN32_WINNT
// set WINVER based on _WIN32_WINNT
#define WINVER          _WIN32_WINNT
#else
#define WINVER          0x0A00
#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

11
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?