Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Getting error message from HRESULT?

This topic is 6924 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone know if it''s possible to get some type of an error message out of a failed HRESULT? Basically I want to test any funtion that returns an HRSESULT value, and if it fails, pass the returned HRESULT value to a function which will process it and print out the appropriate error message. Is there any type of Windows function that retrieves some type of explanation of the error from the HRESULT, or do I got to hard code a huge switch statement with all possible error codes and print out self created messages myself?

Share this post

Link to post
Share on other sites
the Failed macro:


this works. or, you can check to see if theResult is any specific error value. You can see a list of possible erros in the MS help docs, under "HRESULT".

To get a specific explanation, i think the GetError function in windows or something like that would work, but im not sure.
Otherwise, you''ll need a huge switch statement like you said .

PCMCIA - People Can't Memorize Computer Industry Acronyms
ISDN - It Still Does Nothing
APPLE - Arrogance Produces Profit-Losing Entity
SCSI - System Can't See It
DOS - Defunct Operating System
BASIC - Bill's Attempt to Seize Industry Control
IBM - I Blame Microsoft
DEC - Do Expect Cuts
CD-ROM - Consumer Device, Rendered Obsolete in Months
OS/2 - Obsolete Soon, Too.
WWW - World Wide Wait
MACINTOSH - Most Applications Crash; If Not, The Operating System Hangs

Share this post

Link to post
Share on other sites
I don''t think there is a Win32 function that does that, but with D3DX you have D3DXGetErrorString(HRESULT, DWORD, LPSTR) that takes a HRESULT and fills the supplied string with text that is understandable.

- WitchLord

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!