HRESULT error checking

Started by
4 comments, last by GameDev.net 18 years, 6 months ago
Hey all, I've read multiple posts about HRESULT returns for error checking. And I've done pretty much all of it. I'm still only getting an integer value for my return value. I put this in my watch: --> hres,hr -2005530516 HRESULT As you can see, i'm still getting the numerical value instead of a string. Is there a list of all the return values as an enum or something I can put in a swtich statement, and just return a string myself? (A list for all Direct3D functions). I have one for DirectDraw functions, which serves no purpose for me :) Thanks, would appreciate some help on this one. -Mario (Edit): hres = m_pD3DSprite->Draw(m_SpriteList.d3dTexture, NULL, &centerPos, &screenPos, ALPHA(a)); if(FAILED(hres)) { MessageBox(NULL, "Failed to draw bitmap using DrawBMP() function", "D3DError", MB_OK); return E_FAIL; } I'm currently doing things such as this. And getting the numerical value for hresult, declared earlier in this post.
Advertisement
Have you had a look at the DXGetErrorString9() function? It takes an HRESULT and returns a string pointer to the error string.

There is also the DXGetErrorDescription9() function, which returns a slightly more user friendly text of the return value.

HRESULT hr = SomeDirectXFunction();if (hr != D3D_OK){   CString nErrorText;   nErrorText.Format("SomeDirectXFunction failed: %s - %s", DXGetErrorString9(hr),DXGetErrorDescription9(hr) );    _cputs(nErrorText.GetString());}
You're getting a number because the HRESULT values are #define'd constants. You can use DXGetErrorString9() to get the name of the HRESULT whereupon you can look up what it means in the DirectX documentation.

EDIT: Beaten :0
You can also use the "Visual C++ Error Lookup" tool to load the module and look up the error.
Thanks, i'll work with that.
Since I'm a guest, because of some problems while registering, I can't make a new thread. And that's why I'm posting here, sorry about that.
I wanna ask if anyone could tell me where to find some tutorials - DirectPlay, DelphiX ?
tnx in advance.

This topic is closed to new replies.

Advertisement