Direct3DCreate9 function (Windows)

Switch View :
ScriptFree
Direct3DCreate9 function

Applies to: desktop apps only

Create an IDirect3D9 object and return an interface to it.

Syntax

IDirect3D9* Direct3DCreate9(
  UINT SDKVersion
);

Parameters

SDKVersion

Type: UINT

The value of this parameter should be D3D_SDK_VERSION. See Remarks.

Return value

Type: IDirect3D9*

If successful, this function returns a pointer to an IDirect3D9 interface; otherwise, a NULL pointer is returned.

Remarks

The Direct3D object is the first Direct3D COM object that your graphical application needs to create and the last object that your application needs to release. Functions for enumerating and retrieving capabilities of a device are accessible through the Direct3D object. This enables applications to select devices without creating them.

Create an IDirect3D9 object as shown here:



LPDIRECT3D9 g_pD3D = NULL;
    
if( NULL == (g_pD3D = Direct3DCreate9(D3D_SDK_VERSION)))
    return E_FAIL;


The IDirect3D9 interface supports enumeration of active display adapters and allows the creation of IDirect3DDevice9 objects. If the user dynamically adds adapters (either by adding devices to the desktop, or by hot-docking a laptop), those devices will not be included in the enumeration. Creating a new IDirect3D9 interface will expose the new devices.

D3D_SDK_VERSION is passed to this function to ensure that the header files against which an application is compiled match the version of the runtime DLL's that are installed on the machine. D3D_SDK_VERSION is only changed in the runtime when a header change (or other code change) would require an application to be rebuilt. If this function fails, it indicates that the header file version does not match the runtime DLL version.

For an example, see Creating a Device (Direct3D 9).

Requirements

Header

D3D9.h

Library

D3D9.lib

See also

Direct3D Functions

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Content

Mclankyman
Linker error

I have an unresolved external symbol error come up with this function. I can't work out why.

I have made a direct3d class with a .cpp and .h file and put #include "d3d9.h" at the top of .h and  .cpp file 

My create function of the class calls the Direct3DCreate9 function and assigns it to my Object member.

Any ideas why it is not linking correctly?


mona1960
need to download directX d3d device,please.
i really need to download a d3d device for my computer. Please send me information to do this.

elbahy
direct 3d device dowenload
I wish to DOWENLOAD Direct 3D Device for 3D IMAGE