DirectX SDK

Step 1: Obtain Installed DirectDraw Devices

[C++]

This section pertains only to application development in Visual Basic. See DirectDraw C/C++ Tutorials.

[Visual Basic]

DirectX for Visual Basic enables you to query the display hardware's capabilities at run time, then provide the best performance possible given the host computer's hardware capabilities. This is easily accomplished through the use of the many enumeration objects in the DxVBLib type library.

The first step is to obtain all DirectDraw devices installed on the system. In addition to the primary display adapter, some systems have multiple display cards. A common scenario is a secondary 3-D graphics card. All the installed devices are obtained by calling the DirectX7.GetDDEnum method. This method returns a DirectDrawEnum object which you then query for information. Through the methods of the DirectDrawEnum object, you can retrieve the number of installed devices and the name, description, GUID and monitor handle for each individual device.

In the Tutorial 5 sample application this is done with the following code:

Dim ddEnum As DirectDrawEnum
Dim strGuid As String

Set ddEnum = m_dx.GetDDEnum()
OutList.AddItem "Display Cards"
For i = 1 To ddEnum.GetCount()
    OutList.AddItem " Index        " + Str(i)
    OutList.AddItem " Description  " + ddEnum.GetDescription(i)
    OutList.AddItem " Name         " + ddEnum.GetName(i)
    OutList.AddItem " GUID         " + ddEnum.GetGuid(i)
    OutList.AddItem ""

    strGuid = ddEnum.GetGuid(i)
    GetDDCaps strGuid
    GetD3DDevices strGuid
    GetDisplayModes strGuid

Next

Notice that GetDDCaps, GetD3DDevices and GetDisplayModes procedures are called for each device found installed on the system.

The information is displayed by populating a List box control.

Next: Step 2: Display DirectDraw Device Capabilities