DirectX SDK |
The information in this section pertains only to applications written in C and C++. See Direct3D Immediate Mode Visual Basic Tutorials.
The Enumeration application uses the following structure to hold information about the enumerated Direct3D devices:
struct D3DDEVICEINFO { // D3D Device info CHAR strDesc[40]; GUID* pDeviceGUID; D3DDEVICEDESC7 ddDeviceDesc; BOOL bHardware; // DDraw Driver info GUID* pDriverGUID; DDCAPS ddDriverCaps; DDCAPS ddHELCaps; // DDraw Mode Info DDSURFACEDESC2 ddsdMode; BOOL bFullscreen; // For internal use (apps should not need these) GUID guidDevice; GUID guidDriver; DDSURFACEDESC2 ddsdModes[100]; DWORD dwNumModes; DWORD dwCurrentMode; BOOL bDesktopCompatible; };
The Enumeration application initiates enumeration with the following call:
INT UserDlgSelectDriver( HWND hwndParent ) { // Enumerate drivers, devices, and modes DirectDrawEnumerateEx( DriverEnumCallback, NULL, DDENUM_ATTACHEDSECONDARYDEVICES | DDENUM_DETACHEDSECONDARYDEVICES | DDENUM_NONDISPLAYDEVICES );
In the preceding code, the DirectDrawEnumerateEx method is used to enumerate the drivers, devices, and display modes available on the system. The first parameter, DriverEnumCallback, is the address of a DDEnumCallbackEx function that will be called with a description of each enumerated DirectDraw-enabled HAL.
The process of enumerating devices for your application can be broken down into the following steps:
The first step for an application that uses device enumeration is to retrieve a reference to the DirectDraw driver. Driver enumeration is explained in Step 1.1: Enumerate Driver Information.
For more information on starting device enumeration, see Starting Device Enumeration.