|
From: Luke D. <cod...@ho...> - 2003-09-24 02:07:34
|
----- Original Message ----- From: "Dimitri Papadopoulos-Orfanos" <pap...@us...> To: <min...@li...> Sent: Tuesday, September 23, 2003 6:11 PM Subject: [MinGW-dvlpr] w32api: WINVER and _WIN32_* macros > Hi, > > I've read last October's "_NT4, _W95. _W98 etc version defines" thread. > http://sourceforge.net/mailarchive/forum.php?thread_id=2974051&forum_id=5123 > > I'm happy the constants were removed and numeric values used again. > > I can understand this test macro: > _WIN32_IE defines the target IE level > > But I don't feel comfortable with these test macros: > WINVER > _WIN32_WINDOWS > _WIN32_WINNT > What's the difference? What do they mean? Which one should be used? Are > they documented? > > One of the best source I was able to find is: > http://homepage3.nifty.com/aokura/tips/trouble.html > > Windows 95 and Windows NT WINVER=0x0400 > Windows 98 and Windows NT _WIN32_WINDOWS=0x0410 && WINVER=0x0400 > Windows NT 4.0 _WIN32_WINNT=0x0400 && WINVER=0x0400 > Windows 98 _WIN32_WINDOWS=0x0410 > Windows 2000 _WIN32_WINNT=0x0500 && WINVER=0x0500 > Windows Me _WIN32_WINDOWS=0x0490 > Windows XP _WIN32_WINNT=0x0501 && WINVER=0x0501 > > Internet Explorer 3.0-3.02 _WIN32_IE=0x0300 > Internet Explorer 4.0 _WIN32_IE=0x0400 > Internet Explorer 4.01 _WIN32_IE=0x0410 > Internet Explorer 5.0 _WIN32_IE=0x0500 > Internet Explorer 5.01-5.5 _WIN32_IE=0x0501 > Internet Explorer 6.0 _WIN32_IE=0x0600 > > I see that we're sometimes using > (_WIN32_WINNT >= 0x0500) > and sometimes > (WINVER >= 0x0500) > These look like synonyms. Which one should be used? IMHO we should avoid using WINVER in headers and user source code should avoid defining it, because I believe it is no longer mentioned in MSDN Library. I'm not sure that WINVER and _WIN32_WINNT are exactly equivalent though, despite this part of our windef.h: #ifndef _WIN32_WINNT #define _WIN32_WINNT WINVER /* * There may be the need to define _WIN32_WINNT to a value different from * the value of WINVER. I don't have any example of why you would do that. * However, if you must then define _WIN32_WINNT to the value required before * including windows.h or any other method of including the windef.h header. */ #endif For example, software targeted to Win95/NT4 (which should be the default) implies only WINVER=0x0400, while software that uses functions present on NT4/2K/XP but not 9x/ME implies both WINVER=0x0400 and _WIN32_WINNT=0x0400 (the actual default). If the goal of w32api was to support only Win95 functionality by default, then I believe we should not define _WIN32_WINNT at all, and NT-only features (e.g. PlgBlt) should be guarded by "#if _WIN32_WINNT >= 0x0400". This is not the current state of the headers though, and I'm not suggesting that it is worth the effort to change, so we should just be aware of it. To answer your question, I think that "WINVER >= 0x0500" should not be used. Luke > > According to this page: > http://msdn.microsoft.com/library/en-us/midl/midl/targeting_stubs_for_specific_32_bit_or_64_bit_platforms.asp > > Windows NT 3.51, Windows 95, or later WINVER=0x400 > Windows NT 4.0, Windows 2000, or later _WIN32_WINNT=0x400 > Windows 2000 or later releases _WIN32_WINNT=0x500 > > -- > Dimitri > |