What might cause IDirectDraw::GetCaps returns DDERR_INVALIDPARAMS? <p>I have this little snippet of code with IDirectDraw::GetCaps returning <code>DDERR_INVALIDPARAMS</code> (a.k.a. <code>E_INVALIDARG</code>, a.k.a. 0x80070057).</p> <p>The loaded dll is ddraw.dll 5.03.2600.5512 (xpsp.080413-0845)</p> <p>I need to check whether the display hardware has 3D acceleration (DDCAPS_3D).</p> <p>I have no idea to solve the problem, the snippet is so simple, am I missing something?</p> <p>Thank you very much.</p> <p>Alessandro</p> <pre><code>#include &lt;ddraw.h&gt; #include &lt;iostream&gt; #define TEST_HR(hr) if(hr!=DD_OK){ std::cout &lt;&lt; "Error 0x" &lt;&lt; std::hex &lt;&lt; static_cast&lt;unsigned long&gt;(hr) &lt;&lt; " at line: " &lt;&lt; std::dec &lt;&lt; __LINE__; return __LINE__;} int main(int argc, char* argv[]) { ::CoInitialize( 0 ); IDirectDraw* dd; TEST_HR( ::DirectDrawCreate( 0, &amp;dd, 0 ) ); DDCAPS hel_caps, hw_caps; ::ZeroMemory( &amp;hel_caps, sizeof( DDCAPS ) ); ::ZeroMemory( &amp;hw_caps, sizeof( DDCAPS ) ); TEST_HR( dd-&gt;GetCaps( &amp;hw_caps, &amp;hel_caps ) ); ::CoUninitialize(); return 0; } </code></pre>