Cryptic HRESULT errors

0

The following EndDraw() function returns an HRESULT error code: http://msdn.microsoft.com/en-us/library/windows/desktop/dd371924%28v=vs.85%29.aspx

The documentation specifies:

If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code and sets tag1 and tag2 to the tags that were active when the error occurred.

...and then returns an HRESULT indicating the success of the operations...

I am getting a return value of -2003238911 (0x88990001) which doesn't appear on Microsoft's "Common HRESULT values" page: http://msdn.microsoft.com/en-us/library/windows/desktop/aa378137%28v=vs.85%29.aspx

I have also searched for the error code in WinError.h but can't find it there either. If it returns this code, there must be a way to find out what it means.

How do I interpret this error code to find out what went wrong?

c++
windows
directx
hresult
asked on Stack Overflow Feb 11, 2013 by user974967 • edited Jun 20, 2020 by Community

3 Answers

3

You use the Google, on which the top result for that hex code has this:

D2DERR_WRONG_STATE
0x88990001
The object was not in the correct state to process the method.

http://msdn.microsoft.com/en-us/library/windows/desktop/dd370979(v=vs.85).aspx

I don't know the first thing about graphics programming or Windows programming, but I think this answers your question, combined with the docs stating that the tag values will be given back to you referring to the point where the error occurred.

answered on Stack Overflow Feb 11, 2013 by John Zwinck
0

Last but not least..

I got the same error, till i realized that i wasn't calling ID2D1HwndRenderTarget::BeginDraw() first in order to prepare the render target for draw calls.

answered on Stack Overflow Jun 17, 2013 by Loul G.
0

(I just created an account to vote up the answer by Loul G. but I don't have permission to vote yet...)

I have had this same issue...

When BeginDraw() and EndDraw() are called out of order you can get HRESULT: 0X88990001

Trace back to see the order in which they are called.

Also, to help protect against this you can surround BeginDraw(), EndDraw() calls like:

bool beginCalled;
int beginCount;//for debugging
int endCount;//for debugging
//initialize variables somewhere...

void begin(){
   rendTarget>BeginDraw();
   beginCalled = true;
   beginCount++;
}

void end(){
   if(beginCalled){
      rendTarget->EndDraw();
      beginCalled = false;
   }
   endCount++;

} 

//print counts as necessary for debugging
answered on Stack Overflow Oct 20, 2014 by NRCIS

User contributions licensed under CC BY-SA 3.0