c++directxdirectdraw

How to get DirectDraw Last error string(DirectX 7)


When I failed executing a DirectDraw method, how to get the failure error string in DirectX 7?

if (FAILED(lpddPrimarySurface->SetPalette(lpddPalette)))
{
    MessageBox(NULL, **"I want to get the failure string here."**, "Error", MB_OK);
    return 0;
}

Here I want to pop up the error messge of the failure information. How to get the LPCSTR string of the error?


Solution

  • There is no error string provided by DirectDraw. You have to look at the returned HRESULT and format your own string as needed. For example:

    http://www.gamedev.net/topic/8268-ddraw-error-code/