IDirect3D9Ex::CreateDeviceEx method

Creates a device to represent the display adapter.

Syntax

HRESULT CreateDeviceEx(
  UINT                  Adapter,
  D3DDEVTYPE            DeviceType,
  HWND                  hFocusWindow,
  DWORD                 BehaviorFlags,
  D3DPRESENT_PARAMETERS *pPresentationParameters,
  D3DDISPLAYMODEEX      *pFullscreenDisplayMode,
  IDirect3DDevice9Ex    **ppReturnedDeviceInterface
);

Parameters

Adapter

Type: UINT

Ordinal number that denotes the display adapter. D3DADAPTER_DEFAULT is always the primary display adapter.

DeviceType

Type: D3DDEVTYPE

Specifies the type of device. See D3DDEVTYPE. If the desired device type is not available, the method will fail.

hFocusWindow

Type: HWND

The focus window alerts Direct3D when an application switches from foreground mode to background mode. For full-screen mode, the window specified must be a top-level window. For windowed mode, this parameter may be NULL only if the hDeviceWindow member of pPresentationParameters is set to a valid, non-NULL value.

BehaviorFlags

Type: DWORD

Combination of one or more options (see D3DCREATE) that control device creation.

pPresentationParameters

Type: D3DPRESENT_PARAMETERS*

Pointer to a D3DPRESENT_PARAMETERS structure, describing the presentation parameters for the device to be created. If BehaviorFlags specifies D3DCREATE_ADAPTERGROUP_DEVICE, this parameter is an array. Regardless of the number of heads that exist, only one depth/stencil surface is automatically created.

This parameter is both an input and an output parameter. Calling this method may change several members including:

  • If BackBufferCount, BackBufferWidth, and BackBufferHeight are 0 before the method is called, they will be changed when the method returns.
  • If BackBufferFormat equals D3DFMT_UNKNOWN before the method is called, it will be changed when the method returns.

pFullscreenDisplayMode

Type: D3DDISPLAYMODEEX*

The display mode for when the device is set to fullscreen. See D3DDISPLAYMODEEX. If BehaviorFlags specifies D3DCREATE_ADAPTERGROUP_DEVICE, this parameter is an array. This parameter must be NULL for windowed mode.

ppReturnedDeviceInterface

Type: IDirect3DDevice9Ex**

Address of a pointer to the returned IDirect3DDevice9Ex, which represents the created device.

Return Value

Type: HRESULT

This method returns S_OK when rendering device along with swapchain buffers are created successfully. D3DERR_DEVICELOST is returned when any error other than invalid caller input is encountered.

Requirements

   
Target Platform Windows
Header d3d9.h
Library D3D9.lib

See Also

IDirect3D9Ex