Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft C++ exception: long at memory location

I saw "Microsoft C++ exception: long at memory location" at this line :
pDev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, m_Size * m_Size, 0, m_TriangleCount);

pDev is LPDIRECT3DDEVICE9 and I used DirectX 9.0.
I don't know what 'long at memory location' means exactly.
Why the message is printed at this line?

like image 615
Gimun Eom Avatar asked Feb 27 '26 21:02

Gimun Eom


1 Answers

You should ignore any "first chance exception" message that you see in the Output window, that just shows exceptions being used internally in the DirectX plumbing to deal with error conditions. An exception is only fatal when it doesn't get caught.

What you should never ignore is the return value of DrawIndexedPrimitive(). It returns an HRESULT, a status code that indicates whether or not the function call succeeded. The rough code ought to look like this:

HRESULT hr = pDev->DrawIndexedPrimitive(...);
if (FAILED(hr)) {
    // Report error code stored in "hr" and terminate
    //...
}
like image 194
Hans Passant Avatar answered Mar 02 '26 09:03

Hans Passant



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!