Platform SDK: DirectX |
This topic applies to applications written in C++. For information on distributing an application written in Visual Basic, see Installing DirectX for Visual Basic Applications.
Applications and games that depend on DirectX use the DirectXSetup function to install the necessary system components into an existing Windows installation. The function optionally updates the display and audio drivers for optimal support of DirectX. Typically, you would call DirectXSetup from the program that you are using to install your own application files.
Note The DirectXSetup function overwrites system components from previous versions of DirectX. For example, if you install DirectX 7.0 on a system that already has DirectX 5.0 components, all DirectX 5.0 components are overwritten. Because all DirectX components comply with Component Object Model (COM) backward-compatibility rules, software written for DirectX 5.0 continues to function properly.
The DirectXSetup function can tell when DirectX components, display drivers, and audio drivers need to be upgraded. It can also distinguish whether or not these components can be upgraded without adversely affecting the Windows operating system. This is said to be a safe upgrade. The upgrade is safe for the operating system, not necessarily for the applications running on the computer. Some hardware-dependent applications can be negatively affected by an upgrade that is safe for Windows.
By default, the DirectXSetup function performs only safe upgrades. If the upgrade of a device driver might adversely affect the operation of Windows, the upgrade is not performed.
During the setup process, DirectSetup creates a backup copy of the system components and drivers that are replaced. These can be restored if problems occur.
When display or audio drivers are upgraded, the DirectXSetup function uses a database created by Microsoft to manage the process. The database contains information on existing drivers that are provided by Microsoft, the manufacturers of the hardware, or the vendors of the hardware. This database describes the upgrade status of each driver, based on testing done at Microsoft and other sites.
Check the value returned by DirectXSetup. If it is DSETUPERR_SUCCESS_RESTART, notify the user that changes do not take effect without a restart, and offer the choice of restarting immediately. See Dinstall.c in the Dinstall sample application for an example of how to do this.