Platform SDK: DirectX

Step 2.2: Test the Device

[Visual Basic]

The information in this section pertains only to applications written in C and C++. See Direct3D Immediate Mode Visual Basic Tutorials.

[C++]

The following code fragment checks the display mode for compatibility with the device, while skipping all 8-bit modes:

        if( (32==dwModeDepth) && (dwBitDepth&DDBD_32) ) bCompatible = TRUE;
        if( (24==dwModeDepth) && (dwBitDepth&DDBD_24) ) bCompatible = TRUE;
        if( (16==dwModeDepth) && (dwBitDepth&DDBD_16) ) bCompatible = TRUE;

Specifically, the preceding code fragment checks to see if the video mode of the specified device is compatible with the rendering depth of the device under enumeration.

If the device is compatible, it is accepted and copied into the array of device-supported display modes:

       if( bCompatible )
            pDeviceInfo->ddsdModes[pDeviceInfo->dwNumModes++] = ddsdMode;
    }

After this loop terminates and all of the devices have been enumerated, the array of display modes, ddsdModes, will hold a list of display modes that meet the specified criteria, all other display modes will be ignored.