IDirect3DMaterial3::GetHandle

The IDirect3DMaterial3::GetHandle method binds a material to a device, retrieving a handle that represents the association between the two. This handle is used in all Direct3D methods in which a material is to be referenced. A material can be used by only one device at a time.

If the device is destroyed, the material is disassociated from the device.

HRESULT GetHandle(
  LPDIRECT3DDEVICE3 lpDirect3DDevice,  
  LPD3DMATERIALHANDLE lpHandle          
);
 

Parameters

lpDirect3DDevice
Address of the IDirect3DDevice3 interface for the rendering device to which the material is being bound.
lpHandle
Address of a variable that will be filled with the material handle corresponding to the Direct3DMaterial object.

Return Values

If the method succeeds, the return value is D3D_OK.

If the method fails, the return value is DDERR_INVALIDOBJECT.

Remarks

In the IDirect3DMaterial2 interface, this method accepts a pointer to an IDirect3DDevice2 interface instead of an IDirect3DDevice3 interface.

QuickInfo

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in d3d.h.
  Import Library: Use ddraw.lib.

See Also

Retrieving Material Handles