The general rule with Windows header files is that if you don't
specify which version of the header file you want,
you get the latest version.
For example, if you have the Windows XP Platform SDK header files
you're going to get the Windows XP function prototypes,
the Windows XP structures, the
the Windows XP flags, all that stuff.
And unless you're careful,
the program you get as a result will most likely run only
on Windows XP.
If you call a function that is new for Windows XP, then your program won't run on earlier versions of Windows because the import can't be resolved.†
If you use a structure that changed for Windows XP, then your program won't run on earlier versions of Windows because the structure size will be wrong.
Even if the structure size didn't change, using a flag that was introduced in Windows XP will create difficulties for your program when run on earlier versions of Windows because those earlier versions don't support the flag you're passing. Depending on how the function in question was written, it may ignore the "flag from the future" or it may reject it as invalid.
If you want your program to run on older versions of Windows,
you have a few options.
First, you can explicitly "downgrade" your header file by
defining an appropriate symbol or symbols before including
windows.h header file.
#define WINVER 0x0400 #define _WIN32_WINNT 0x0400 #define _WIN32_WINDOWS 0x0400 #define _WIN32_IE 0x0400 #include <windows.h> #include <commctrl.h> #include <shlobj.h> ...
Oh yuck, now we have the messy world of
"So what's the difference between
We'll pick up this topic next time,
but you're not going to like the answer.
†That statement is from the operating system's‡ point of view. You can of course use techniques like Visual Studio linker's delay-load feature to avoid creating an import dependency, but that's outside the operating system.‡
‡s/operating system/Windows operating system/