Microsoft DirectX 9.0

DXGetErrorString9 Function

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


TCHAR *DXGetErrorString9(      

    HRESULT hr );


[in] Any HRESULT return code from Microsoft Direct3D? Microsoft DirectPlay? Microsoft DirectMusic? Microsoft DirectSound? Microsoft DirectInput? and Microsoft DirectShow?

Return Value

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


This function is designed to retrieve the text equivalent of a DirectX error message from a Direct3D, Direct3D extensions (D3DX), DirectPlay, DirectInput, DirectMusic, or DirectSound method. For example, if you set hr to 0x88760686, DXGetErrorString9 returns D3DERR_DEVICELOST.

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

This method handles all DirectX components including: Direct3D, DirectInput, DirectSound, DirectMusic, DirectShow, DirectPlay, and standard Win32 errors.

This function supports Unicode and ANSI strings.

This function supports Win32 Winerror.h error codes.

Function Information

Import librarydxerr9.lib
Minimum operating systems Windows 98

© 2002 Microsoft Corporation. All rights reserved.