DirectX SDK |
This topic pertains only to applications written in C++. For an introduction to programming for DirectX in Visual Basic, see Visual Basic Programming Topics.
For backward compatibility with previous versions of DirectX, some DirectX components include variable API element definitions in their header files. Affected elements are typically capability structures or flag sets that are version-specific. Parts of some header files are surrounded by preprocessor conditionals that cause the preprocessor to filter out unneeded definitions. The value of the defined constant identifies a specific version of the component; if no value is defined, the headers set a value that identifies the DirectX version for which the header file was written. An example from the DirectDraw header file, Ddraw.h, is shown here:
#ifndef DIRECTDRAW_VERSION #define DIRECTDRAW_VERSION 0x0700 #endif /* DIRECTDRAW_VERSION */
You can define other values for these constants to use newer versions of the header files with previous versions of the components. For example, to use the latest headers to compile against the DirectX 3.0 version of DirectDraw, define DIRECTDRAW_VERSION to be 0x0300. You can set the value for the constant in your development environment, or you can change the value in the header file itself.