The IDirectDrawFactory interface is used to create and enumerate DirectDraw objects that support the extended features of DirectDrawEx (see Using DirectDrawEx for more information).
When to Implement
Do not implement this interface; DirectDrawEx implements it for you.
When to Use
Use this interface in an application when you want to create a DirectDrawEx object.
Methods in Vtable Order
IUnknown methods | Description |
QueryInterface | Retrieves pointers to supported interfaces. |
AddRef | Increments the reference count. |
Release | Decrements the reference count. |
IDirectDrawFactory methods | Description |
CreateDirectDraw | Creates a DirectDraw object and retrieves pointers to the IUnknown and the IDirectDraw interfaces. |
DirectDrawEnumerate | Enumerates the DirectDraw surfaces installed on the system. |
Creates a DirectDraw object and retrieves pointers to the IUnknown and the IDirectDraw interfaces.
STDMETHOD CreateDirectDraw(
GUID * pGUID,
HWND hWnd,
DWORD dwCoopLevelFlags,
DWORD dwReserved,
IUnknown *pUnkOuter,
IDirectDraw **ppDirectDraw
) PURE;
Value | Meaning |
DDCREATE_EMULATIONONLY | The DirectDraw object will use emulation for all features; it will not take advantage of any hardware-supported features. |
DDCREATE_HARDWAREONLY | The DirectDraw object will never emulate features not supported by the hardware. Attempts to call methods that require unsupported features will fail, returning DDERR_UNSUPPORTED (operation not supported). |
Value | Meaning |
DDSCL_ALLOWMODEX | Enables the use of Mode X display modes. You must use this flag with the DDSCL_EXCLUSIVE and DDSCL_FULLSCREEN flags. |
DDSCL_ALLOWREBOOT | Enables CTRL+ALT+DEL to function while in exclusive (full-screen) mode. |
DDSCL_EXCLUSIVE | Requests the exclusive level. You must use this flag with the DDSCL_FULLSCREEN flag. |
DDSCL_FULLSCREEN | Indicates that the exclusive-mode owner will be responsible for the entire primary surface. GDI can be ignored. You must use this flag with the DDSCL_EXCLUSIVE flag. |
DDSCL_NORMAL | Indicates that the application will function as a regular Windows® application. You can't use this flag with the DDSCL_ALLOWMODEX, DDSCL_EXCLUSIVE, or DDSCL_FULLSCREEN flags. |
DDSCL_NOWINDOWCHANGES | Indicates that DirectDraw can't minimize or restore the application window on activation. |
Returns DD_OK if successful, or one of the following error values otherwise:
Value | Meaning |
E_OUTOFMEMORY | There isn't enough memory available to create a DirectDrawEx object. |
DDERR_GENERIC | There is an undefined error condition. |
DDERR_UNSUPPORTED | The operation isn't supported. |
DDERR_DIRECTDRAWALREADYCREATED | A DirectDrawEx object representing this driver has already been created for this process. |
DDERR_INVALIDDIRECTDRAWGUID | The GUID passed to this method is not a valid DirectDrawEx driver identifier. |
DDERR_INVALIDPARAMS | One or more of the parameters passed to the method are incorrect. |
DDERR_NODIRECTDRAWHW | Hardware-only DirectDrawEx object creation isn't possible; the driver doesn't support any hardware. |
This method creates DirectDraw objects in the same way that the DirectDrawCreate function is used to create DirectDraw objects, and sets cooperative levels the same way the IDirectDraw2::SetCooperativeLevel method sets cooperative levels. However, in addition to creating a DirectDraw object, successful calls to the IDirectDrawFactory::CreateDirectDraw method will obtain a pointer to the IUnknown and IDirectDraw interfaces, which are exposed on the DirectDraw object. Applications can now query to obtain the address of a pointer to an IDirectDraw3 interface.
Enumerates the DirectDraw objects installed on the system.
STDMETHOD DirectDrawEnumerate(
LPDDENUMCALLBACK lpCallback,
LPVOID lpContext
) PURE;
Returns DD_OK if successful, or DDERR_INVALIDPARAMS otherwise.
This method functions in a similar manner to the DirectDrawEnumerate function, defined in the DirectX SDK.
Note This method can only be called by your application after a successful call to the IDirectDrawFactory::CreateDirectDraw method.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.