DXGetErrorString

Returns the name associated with an error code. This method is designed to handle error codes from all the DirectX components and Win32 functions.

TCHAR * DXGetErrorString(
  HRESULT hr
);

Parameters

hr
[in] Any HRESULT return code from XACT, Direct3D 10, D3DX10, Direct3D9, D3DX9, Direct3D 8, D3DX8, DirectDraw, DirectInput, DirectMusic, DirectSound, or DirectShow.

Return Values

If successful, this function returns a pointer to a string that contains the name of the error code. If Unicode is set, DXGetErrorString will return a Unicode string. Otherwise, it will return an ANSI string.

Remarks

This function is designed to retrieve the text equivalent of a DirectX error message from an XACT, Direct3D 10, D3DX10, Direct3D9, D3DX9, Direct3D 8, D3DX8, DirectDraw, DirectInput, DirectMusic, DirectSound, or DirectShow method. For example, if you set hr to 0x88760686, DXGetErrorString returns D3DERR_DEVICELOST.

If an error code maps to more than one text string, DXGetErrorString returns a generic string. For example, there are several DirectX error codes, such as D3DERR_OUTOFVIDEOMEMORY, that indicate that you are out of memory, and all map to the same value. If you set hr to any of these codes, DXGetErrorString will return E_OUTOFMEMORY.

This method handles all DirectX components including: XACT, Direct3D 10, D3DX10, Direct3D9, D3DX9, Direct3D 8, D3DX8, DirectDraw, DirectInput, DirectMusic, DirectSound, DirectShow, and standard Win32 errors.

This function supports Unicode and ANSI strings.

This function supports Win32 Winerror.h error codes.

Requirements

Header: Declared in Dxerr.h.