How can I retrieve error strings for DirectX 9
To get DirectX error message, there are two functions — DXGetErrorString()
and DXGetErrorDescription()
. That being said, FormatMessage()
will not get you what you want. Here is a small example:
// You'll need this include file and library linked.
#include <DxErr.h>
#pragma comment(lib, "dxerr.lib")
...
if (FAILED(hr)) {
fprintf(stderr, "Error: %s error description: %s\n",
DXGetErrorString(hr), DXGetErrorDescription(hr));
}