Skip to main content
gamedev.net
🔒 Locked

HRESULT error checking

Started by marionofx15 Oct 10, 2005 at 10:05 AM 4 replies 2.6k views
Original Post
marionofx15
marionofx15
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.
Source
Source
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());}
load_bitmap_file
load_bitmap_file
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
frob
frob
You can also use the "Visual C++ Error Lookup" tool to load the module and look up the error.
marionofx15
marionofx15
Thanks, i'll work with that.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.