Microsoft Windows CE 3.0  

Getting an IDirectDraw4 Interface

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

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 IDirectDraw4interface supersedes the IDirectDraw2interface. This new interface can be obtained by using the IUnknown::QueryInterfacemethod, as the following C++ 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;

The preceding example creates a DirectDraw object, then calls the IUnknown::QueryInterfacemethod of the IDirectDrawinterface it received to create an IDirectDraw4interface

After getting an IDirectDraw4interface, 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 IDirectDraw2and IDirectDraw4, for example) can cause unpredictable results.



 Last updated on Tuesday, May 18, 2004

© 2004 Microsoft Corporation. All rights reserved.