, which is freely available
through the Microsoft Platform SDK
, is, as wharfinger
mentioned, the catch-all windows include
file. It is this way to preserve backwards compatibility
. Of course things like DDE and OLE are still supported, as Windows has a legacy (whether you like it or not), of NOT breaking older programs unless one absolutely has to. Thus there are piles of software
Windows programs used to, in theory, cross-compile
(this was in VS 5
, through something known as WLM
, the Windows Layer for the Macintosh
). This is evident in the files with #ifndef MAC
and the like. The Windows NT 4 HAL
was available in four flavors, and thus you had to account for them, for developers (Alpha
had API emulation
and could run a good deal of x86 binaries). Now you can see that all of the IA 64
stuff is included with that. That is obviously to get ready for the next generation of programs for Intel's new server hardware.
Basically windows.h gives you the four big header files:
- windef.h - All of your definition files. It's for backwards compatability and maintainability.
- winbase.h - All of your api's are defined in here
- wingdi.h - GDI, it's your friend.
- winuser.h - USER definitions and such (Things related to user input, hooks, etc)
Without those four, there's no way you could assemble an app. Small defines like DDE
and the like don't matter if you don't link against them, and the compiler does a good job to get rid of the things that you don't need there.
To answer a few questions:
- _WINDOWS_ and _INC_WINDOWS are there so you can kill redifinition warnings and the like. It's so that you don't end up including files in a loop, and so that you don't have to worry about it. It's a common trick in any API index (check up on Mac OS API files in the carbon SDK or what not, you'll see similar practices).
- WINVER is defined so that certain APIs are available when you "target" certain platforms. For winstance WINVER as 0x0500 is Windows 2000 (NT 5). WINVER 0x0400 is Windows 95 and NT 4.0. WINVER 0x0410 is Windows 98 (and NT 4.0 again). You can also define what version of IE is in there (IE is important if you want the IE browser COM object, or if you want any of the updated common control libraries). Check MSDN for more info on how that actually works, it's a lot to write here.
- As far as Borland is concerned, MS makes a fairly decent effort to try and support their compiler. There are special libraries and such for Direct X, for instance. Otherwise, just stick with what the third party vendor came up with.
- The Windows "philosophy" isn't really default to a "pile of crap", but give the developer the most amount of flexibility in creating an application, without having to muck with your header files. Give them the ability to shut things off as necessary, and to tinker without having to change header files.
Windows.h does not include other things that your app might need, like common controls
in . These are to be added, and linked against so that your app can have them available (don't forget to register the classes with InitCommonControls()
! ). As with anything, it takes some learning, but Microsoft
is really good with it's third party developers
and tries to make their lives as easy as possible.