windows.h is a C language header file provided by the good folks at Microsoft. It describes itself in a comment as the "Master include file for Windows applications." Fair enough: That's what it is.

It's mostly a laundry list of #includes; as far as I can recall (NB: I didn't recall far enough; JayBonci mentions commctrl.h below, and it's not the only one), there aren't any other Windows header files that you need to #include separately1. windows.h includes everything. Sure, that's excessive; we'll get to that in a few paragraphs.

There are a few #defines:

  • _WINDOWS_ is defined with no value; #if defined_WINDOWS_ ), why then I guess that's where you are.

  • WINVER is the presumed version of Windows; it's a hex number where the third-from-lowest digit is the major version, and the other digits are, I suppose, increasingly minor versions or something. Win32's been using 0x0400 for years now, and I don't have any old 16-bit windows compilers right on hand to compare with.

  • _INC_WINDOWS: Damned if I know. It's undocumented.

  • _MIPS_, _ALPHA_, _PPC_: Ha ha. When NT4 was first released, it was supported on all of those processors in addition to x86. They started abandoning them, one by one, after a year or two; Alpha was the last to go. But the evidence lives on in the header file.

If you're annoyed by the promiscuous inclusiveness of the thing, you can #define WIN32_LEAN_AND_MEAN and it'll skip over a bunch of #includes, like for example shellapi.h and the ever-crucial dde.h (remember DDE? They're still supporting it . . . (NB: As JayBonci suggests, that is not a bad thing)) There's also a list of about forty "flags" that you can #define so as to exclude more specific sets of functions and/or #defines: NOKANJI, NOVIRTUALKEYCODES, etc. etc.

This is the Windows "philosophy", I suppose: Default to a blizzard of crap, and let more sophisticated users whittle away the unwanted excess. There is a bit of a contrast with standard C and C++ header files, where if you want something you'll need to go looking for it. stdlib.h has a lot of stuff in it, but it's hardly all-inclusive.



1You may run into problems in a weird environment. For example, Borland C++ Builder includes windows.h via its own headers, but it manages not to #include shellapi.h. It may be that they #define WIN32_LEAN_AND_MEAN, or that they include everything piecemeal. I've got the compiler right here, but that's another writeup.