다음을 통해 공유


Getting an IDirectDraw4 Interface (Windows CE 5.0)

Send Feedback

The Component Object Model on which DirectX is built specifies that an object can provide new functionality through new interfaces, without affecting backward compatibility.

To this end, the IDirectDraw4 interface supersedes the IDirectDraw2 interface.

This new interface can be obtained by using the IUnknown::QueryInterface method, as the following C++ code example shows.

// Create an IDirectDraw4 interface. 
LPDIRECTDRAW  lpDD; 
LPDIRECTDRAW4 lpDD4; 
 
ddrval = DirectDrawCreate(NULL, &lpDD, NULL); 
if(ddrval != DD_OK) 
    return; 
 
ddrval = lpDD->SetCooperativeLevel(hwnd, 
    DDSCL_NORMAL); 
if(ddrval != DD_OK) 
    return; 
 
ddrval = lpDD->QueryInterface(IID_IDirectDraw4, 
    (LPVOID *)&lpDD4); 
if(ddrval != DD_OK) 
    return; 

This code example creates a DirectDraw object and then calls the IUnknown::QueryInterface method of the IDirectDraw interface it received to create an IDirectDraw4 interface.

After getting an IDirectDraw4 interface, you can begin calling its methods to take advantage of new functionality, 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 IDirectDraw2 and IDirectDraw4, for example) can cause unpredictable results.

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.