DirectX SDK

Step 2: Display DirectDraw Device Capabilities

[C++]

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

[Visual Basic]

To obtain the DirectDraw hardware and software capabilities for the device you must first create the DirectDraw object, set the cooperative level of the application and call the DirectDraw7.GetCaps method. This method takes two parameters both DDCAPS type variables. Calling this method fills the first parameter, hwCaps, with the capabilities of the hardware. The second parameter, helCaps, is filled with the capabilities of the hardware emulation layer (HEL). For more information on software and hardware capabilities, see the Architectural Overview for DirectDraw topic.

After the GetCaps method is called, displaying the capabilities is done by checking the flags returned in the DDCAPS variables:

Dim dd As DirectDraw7
Dim hwCaps As DDCAPS   'HARDWARE
Dim helCaps As DDCAPS  'SOFTWARE EMULATION

Set dd = m_dx.DirectDrawCreate(sGuid)
dd.SetCooperativeLevel Me.hWnd, DDSCL_NORMAL

'Its always a good idea to figure out if the HW
'supports a feature
'Unsupported features however are emulated via
'software but are much slower
dd.GetCaps hwCaps, helCaps

'how much video memory is available
OutList.AddItem "  HW CAPS"
OutList.AddItem "   total video memory " + Str(hwCaps.lVidMemTotal)
OutList.AddItem "   free video memory " + Str(hwCaps.lVidMemFree)

'Palette Support
'Most apps don't use palettes since
'all cards support 16bpp
'Some apps use 8bpp for speed

lVal = hwCaps.lPalCaps
If (lVal = 0) Then
    OutList.AddItem "   no hw palette support"
End If
If (lVal And DDPCAPS_1BIT) Then
    OutList.AddItem "   palette support 1bpp "
End If
If (lVal And DDPCAPS_2BIT) Then
    OutList.AddItem "   palette support 2bit "
End If

'do we support the gamma ramp interface?
lVal = hwCaps.ddsCaps.lCaps2
If lVal And DDCAPS2_CANCALIBRATEGAMMA Then
    OutList.AddItem "   supports gamma correction"
Else
    OutList.AddItem "   no support for gamma correction"
End If

Set dd = Nothing

Next: Step 3: Display DirectDraw Device 3-D Capabilities