Platform SDK: DirectX

Getting an IDirectDraw7 Interface

[C++]

DirectX 7.0 has a new function to create an IDirectDraw7 interface, DirectDrawCreateEx. This function is the only way to create the newest iteration of this DirectDraw object which supports the new features of DirectDraw and Direct3D. The IDirectDraw7 interface supersedes the IDirectDraw4 interface. This new interface can be obtained by using the DirectDrawCreateEx function, as the following C++ example shows.

// Initialize DirectDraw

LPDIRECTDRAW7 lpDD7;
HRESULT hr;
if (FAILED(hr = DirectDrawCreateEx(NULL, (VOID**)&lpDD7, IID_IDirectDraw7, NULL)))
    return FALSE;

if (FAILED(hr = lpDD7->SetCooperativeLevel(NULL, DDSCL_NORMAL)))
    return FALSE;

After getting an IDirectDraw7 interface, you can begin calling its methods to take advantage of new features, performance improvements, and behavioral differences. Because some methods might change with the release of a new interface, mixing methods from an interface and its replacement (between IDirectDraw4 and IDirectDraw7, for example) can cause unpredictable results.

[Visual Basic]

In Visual Basic, the DirectDraw object is obtained by calling the DirectX7.DirectDrawCreate method.