Yet another effort at translating the Win32 API headers

xs0 xs0 at xs0.com
Wed Mar 29 05:02:38 PST 2006


Stewart Gordon wrote:
> It would also be nice if the policy for using the versions is clearer 
> than the WINVER/_WIN32_WINDOWS/_WIN32_WINNT stuff is at the moment.  At 
> the moment, I'm puzzled by the number of instances of this
> 
> #if (_WIN32_WINDOWS >= 0x0410 || _WIN32_WINNT >= 0x0500)
> 
> or similar.  It seems to be saying that the function may be used by 
> either an application that supports Win98 or an application that 
> supports Win2000.  So you could have a program that works on Windows 98 
> and Windows NT4 but not Windows 95, or a program that works on Windows 
> 95 and Windows 2000 but not Windows NT4, and whatever is in that #if 
> would be available to either.  Unless I'm misunderstanding, it would 
> appear that the || should be an &&.

I think that the system is like this:

_WIN32_WINDOWS is defined only for Win95/98/Me (the crappy ones)
_WIN32_WINNT is defined only for Win NT4/2k/XP/Vista/... (the OK ones)

WINVER is defined for all Windows, and equals _WIN32_* for any given OS.

Now, the above condition does have to use an ||, as it's never the case 
that both are defined. It's also true that it could simply be (in this case)

#if (WINVER >= 0x0410)

because there is no _WIN32_WINNT between 0x0410 and 0x0500..

You also made a slight mistake - the condition doesn't hold for neither 
of NT4 or Win95, so it's actually not that confusing :)



xs0



More information about the Digitalmars-d-announce mailing list