title: C++ function to do DxDiag "Direct3D Acceleration" detection
body: <p>Microsoft DxDiag can detect whether a system has "Direct3D Acceleration".</p>
  
  <p>If the system has not the capability, DxDiag will write "Direct3D Acceleration not available" and will write in the console "Direct3D functionality not available.  You should verify that the driver is a final version from the hardware manufacturer."</p>
  
  <p>I would like the same with a C++ function.</p>
  
  <p>I made some tests and the following function seems to do the job.</p>
  
  <p>Any other better idea?</p>
  
  <p>Thank you.</p>
  
  <p>Alessandro</p>
  
  <pre><code>#include &lt;ddraw.h&gt;
  #include &lt;atlbase.h&gt;
  
  bool has3D()
  {
     CComPtr&lt; IDirectDraw &gt; dd;
     HRESULT hr = ::DirectDrawCreate( 0, &amp;dd, 0 );
     if ( hr != DD_OK ) return false;
  
     DDCAPS hel_caps, hw_caps;
     ::ZeroMemory( &amp;hel_caps, sizeof( DDCAPS ) );
     ::ZeroMemory( &amp;hw_caps, sizeof( DDCAPS ) );
     hw_caps.dwSize = sizeof( DDCAPS );
     hel_caps.dwSize = sizeof( DDCAPS );
     hr = dd-&gt;GetCaps( &amp;hw_caps, &amp;hel_caps );
     if ( hr != DD_OK ) return false;
  
     return (hw_caps.dwCaps &amp; DDCAPS_3D) &amp;&amp; (hel_caps.dwCaps &amp; DDCAPS_3D);
  }
  </code></pre>