Displaying HRESULT String Names and Descriptions

Started by
1 comment, last by S1CA 17 years, 10 months ago
Are there any general Windows functions that will give me a string for the name and/or description of an HRESULT similar to DXGetErrorString9() and DXGetErrorDescription9() for DirectX errors?
Advertisement
FormatMessage ? (at least for error codes)
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
And in the debugger (in case you ever just want to check rather than do it programmatically) - put a watch on:

@err,hr

@err is equivilent to calling GetLastError(), and the ,hr translates a HRESULT to a string for Windows result codes. You can also use the ,hr on your own variables:

HRESULT result = SomeWin32CallThatReturnsAHRESULT();
...
put a watch on: result,hr

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

This topic is closed to new replies.

Advertisement