{"id":27283,"date":"2007-04-11T10:00:00","date_gmt":"2007-04-11T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2007\/04\/11\/whats-the-difference-between-winver-_win32_winnt-_win32_windows-and-_win32_ie\/"},"modified":"2007-04-11T10:00:00","modified_gmt":"2007-04-11T10:00:00","slug":"whats-the-difference-between-winver-_win32_winnt-_win32_windows-and-_win32_ie","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20070411-00\/?p=27283","title":{"rendered":"What&#039;s the difference between WINVER, _WIN32_WINNT, _WIN32_WINDOWS, and _WIN32_IE?"},"content":{"rendered":"<p>\nOkay, so there are\n<a HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2007\/04\/10\/2065725.aspx\">\nall these different ways you can specify\nwhat version of the Windows header files you want<\/a>.&dagger;\n<\/p>\n<pre>\n#define WINVER         0x0400\n#define _WIN32_WINNT   0x0400\n#define _WIN32_WINDOWS 0x0400\n#define _WIN32_IE      0x0400\n<\/pre>\n<p>\nLet&#8217;s take them in order.\n<\/p>\n<p>\nThe <code>WINVER<\/code> symbol is the earliest one.\nThat&#8217;s the symbol that 16-bit Windows used to control the\nversioning of its header files,\nand its use carried forward into the 32-bit header files,\npresumably from the people who did the initial conversion\nof the header files to 32-bit and who grew up with the\n<code>WINVER<\/code> symbol.\nThis symbol is still used a lot in the header files that\ncan trace their origins to 16-bit Windows, such as\n<code>winuser.h<\/code>,\n<code>wingdi.h<\/code>, and\n<code>mmsystem.h<\/code>.\n<\/p>\n<p>\nThe <code>_WIN32_WINNT<\/code> symbol came next.\nI&#8217;m not sure where it came from, but from its name\nit probably was invented by the Windows&nbsp;NT team\nin order to allow them to block off sections of the\nheader file that are available only in the Windows&nbsp;NT implementation\nof Win32.\nDon&#8217;t forget that in the early days, there was also Win32s,\na subset of Win32 that could run on 16-bit Windows&nbsp;3.1.\nThe single <code>WINVER<\/code> symbol wasn&#8217;t enough to\nspecify exactly what you wanted to be compatible with.\nFor example, a function available only in Windows&nbsp;NT&nbsp;3.1\nwould be guarded with <code>#if _WIN32_WINNT &gt;= 0x030A<\/code>\nso that programs that wanted to run on Win32s could set\n<code>_WIN32_WINNT<\/code> to zero and keep that function off-limits.\n<\/p>\n<p>\nSimilarly, both Windows&nbsp;95 and Windows&nbsp;NT&nbsp;4 identified\nthemselves as Windows major version 4, so\nthe <code>WINVER<\/code> symbol was insufficient to distinguish them.\nFunctions that existed in Windows&nbsp;NT&nbsp;4 but\nnot in Window&nbsp;95 were therefore guarded with <code>_WIN32_WINNT<\/code>.\n<\/p>\n<p>\nOn the other hand, there were also functions that were first introduced\nin Windows&nbsp;95 and did not exist in\nthe original version of Windows&nbsp;NT&nbsp;4.\nThe <code>_WIN32_WINDOWS<\/code> symbol let you specify that\nyou wanted access to stuff that was new for Windows&nbsp;95 and\nwhich would also be ported to Windows&nbsp;NT&nbsp;4 and future\nversions of Windows&nbsp;NT.\n<\/p>\n<p>\nThe next symbol in this progression is\n<code>_WIN32_IE<\/code>, which lets you specify what version\nof Internet Explorer you require to be installed on the system.\nThis was more important back in the days when Internet Explorer\nincluded updates to selected operating system components.\nFor example, Internet Explorer&nbsp;4 came not only with an\nupdated <code>comctl32.dll<\/code> but also a new\n<code>shell32.dll<\/code> that gave you Active Desktop.\n(Wow, remember Active Desktop?\nThat was when everybody thought that HTML\nwas going to take over the world and people would write\nentire applications in HTML.\nPeople are still trying.)\n<\/p>\n<p>\nAnd history repeated itself:\nWe saw it before when we tried to puzzle out why\n<a HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2004\/03\/02\/82639.aspx\">\nsome functions return\n<code>NULL<\/code> while others return <code>INVALID_HANDLE_VALUE<\/code><\/a>.\nEach time somebody added a new feature to Windows and had to\nadd an <code>#ifdef<\/code> guard,\nit was pretty much a toss-up whether they would use\n<code>WINVER<\/code>,\n<code>_WIN32_WINDOWS<\/code>, or\n<code>_WIN32_WINNT<\/code>.\nOnce Internet Explorer stopped including updates to shell components,\n<code>_WIN32_IE<\/code> fell into the &#8220;toss-up&#8221; bucket as well.\n<\/p>\n<p>\nIn an attempt to make some sense out of this disaster,\nthe SDK and DDK teams came up with a new plan for Windows&nbsp;Vista\nheader files:\n<a HREF=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/aa383745.aspx\">\nsdkddkver.h<\/a>.\nThere&#8217;s now just one symbol you define to specify your minimum\ntarget operating system: <code>NTDDI_VERSION<\/code>.\nOnce you set that, all the other symbols are set automatically\nto the appropriate values for your target operating system.\n(And no, I don&#8217;t know what the letters NTDDI stand for,\nthough there is one\n<a HREF=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/ms789534.aspx\">\nobvious candidate<\/a>.)\nWith any luck,\neverybody wll standardize on\n<code>NTDDI_VERSION<\/code> and this article will become one of those\n&#8220;quaint historical novelties&#8221; like all the ones about\n16-bit Windows.\nJust &#8220;a little story about what people had to do back in the\ncrazy days of the early 21st century.\nBoy am I glad we don&#8217;t have to worry about that any more!&#8221;\n<\/p>\n<p>\n<b>Notes<\/b>\n<\/p>\n<p>\nI&#8217;d appreciate it if people would extend me the courtesy of not\nstepping on my announced topic.\n(I wonder if these are the same people who go to a comedy show\nand shout out the punch lines before the performer gets to say them.)\nI did say that I would pick up the topic today, after all.\n<a HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2007\/04\/10\/2065725.aspx#2082446\">\nIf you really want to steal my topic<\/a>,\nat least be polite enough to post your essay on your own blog.\n<\/p>\n<p>\n<b>Nitpicker&#8217;s corner<\/b>\n<\/p>\n<p>\n&dagger;This list is not intended to be comprehensive.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Okay, so there are all these different ways you can specify what version of the Windows header files you want.&dagger; #define WINVER 0x0400 #define _WIN32_WINNT 0x0400 #define _WIN32_WINDOWS 0x0400 #define _WIN32_IE 0x0400 Let&#8217;s take them in order. The WINVER symbol is the earliest one. That&#8217;s the symbol that 16-bit Windows used to control the versioning [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-27283","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Okay, so there are all these different ways you can specify what version of the Windows header files you want.&dagger; #define WINVER 0x0400 #define _WIN32_WINNT 0x0400 #define _WIN32_WINDOWS 0x0400 #define _WIN32_IE 0x0400 Let&#8217;s take them in order. The WINVER symbol is the earliest one. That&#8217;s the symbol that 16-bit Windows used to control the versioning [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/27283","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=27283"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/27283\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=27283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=27283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=27283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}