Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

IDirect3D9Ex::CreateDeviceEx method (d3d9.h)

Creates a device to represent the display adapter.

Syntax

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

Parameters

[in] Adapter

Type: UINT

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

[in] DeviceType

Type: D3DDEVTYPE

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

[in] 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.

[in] BehaviorFlags

Type: DWORD

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

[in, out] 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.

[in, out] 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.

[out, retval] 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

Requirement Value
Target Platform Windows
Header d3d9.h
Library D3D9.lib

See also

IDirect3D9Ex


Feedback

Was this page helpful?

Additional resources