The DirectXSetupGetVersion function retrieves the version number of the DirectX components that are currently installed.
INT WINAPI DirectXSetupGetVersion(
DWORD *pdwVersion, // receives the version number
DWORD *pdwRevision // receives the revision number
);
If this function is successful, it returns non-zero.
If it is not successful, it returns zero.
The DirectXSetupGetVersion function can be used to retrieve the version and revision numbers before or after the DirectXSetup function is called. If it is called before the DirectXSetup function is invoked, it gives the version and revision numbers of the DirectX components that are currently installed. If it is called after the DirectXSetup function is called, but before the computer has been rebooted, it will give the version and revision numbers of the DirectX components that will take effect after the computer is restarted.
The version number in the pdwVersion parameter is composed of the major version number and the minor version number. The major version number will be in the 16 most significant bits of the DWORD when this function returns. The minor version number will be in the 16 least significant bits of the DWORD when this function returns. The version numbers can be interpreted as follows:
DirectX Version | Value Pointed At By pdwVersion |
---|---|
DirectX 1 | 0x00040001 |
DirectX 2 | 0x00040002 |
DirectX 3 | 0x00040003 |
DirectX 5 | 0x00040005 |
Note that there is no version 4 of DirectX. The version number in the pdwRevision parameter is composed of the release number and the build number. The release number will be in the 16 most significant bits of the DWORD when this function returns. The build number will be in the 16 least significant bits of the DWORD when this function returns.
The following sample code fragment demonstrates how the information returned by DirectXSetupGetVersion can be extracted and used.
DWORD dwVersion;
DWORD dwRevision;
if (DirectXSetupGetVersion(&dwVersion, &dwRevision))
{
printf("DirectX version is %d.%d.%d.%d\n",
HIWORD(dwVersion), LOWORD(dwVersion),
HIWORD(dwRevision), LOWORD(dwRevision));
}
Version and revision numbers can concatenated into a 64 bit quantity for comparison. The version number should be in the 32 most significant bits and the revision number should be in the 32 least significant bits.
Windows NT: Use version 4.0 or later.
Windows: Use Windows 95 or later. Available as a redistributable for Windows 95.
Windows CE: Unsupported.
Header: Declared in dsetup.h.
Import Library: Use dsetup.lib.