IDirect3DMaterial2::GetHandle

The IDirect3DMaterial2::GetHandle method obtains the material handle of the Direct3DMaterial object. 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(
  LPDIRECT3DDEVICE2 lpDirect3DDevice2,  
  LPD3DMATERIALHANDLE lpHandle          
);
 

Parameters

lpDirect3DDevice2
Address of the Direct3DDevice2 object in which the material is being used.
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 IDirect3DMaterial interface, this method uses a pointer to a Direct3DMaterial object instead of a Direct3DMaterial2 object.

QuickInfo

  Windows NT: Use version 5.0 or later.
  Windows: Use Windows 95 or later. Available as a redistributable for Windows 95.
  Windows CE: Unsupported.
  Header: Declared in d3d.h.
  Import Library: Use ddraw.lib.