Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Win32: How to determine if DirectDraw is enabled?

When using CachedBitmaps in GDIPlus, there is graphical corruption if Windows video "Hardware Acceleration" is lowered too much - such that DirectDraw is disabled:

enter image description here

There are six levels of hardware acceleration:

  • Disable all accelerations
  • Disable all but basic accelerations. (Default on server machines)
  • Disable all DirectDraw and Direct3D accelerations, as well as all cursor and advanced accelerations
  • Disable all cursor and advanced drawing accelerations
  • Disable cursor and bitmap accelerations
  • All accelerations are enabled (Default on desktop machines)

If DirectDraw is disabled, then using DrawCachedBitmap in GDI+ will result in graphical corruption. It's easy enough for me to use the slower DrawImage() API if DirectDraw is not enabled - but i have to be able to detect that DirectDraw is disabled.

How can i programatically check if DirectDraw is enabled?


The question is: How does dxdiag do this:

alt text

See also

KB191660 - DirectDraw or Direct3D option is unavailable (archive)

like image 514
Ian Boyd Avatar asked Oct 14 '22 05:10

Ian Boyd


1 Answers

If you download the latest DirectX SDK (I'm sure older sdk's have similar examples) there is an example of querying DXDIAG info.

The example is located at (SDK Root)\Samples\C++\Misc\DxDiagReport

In dxdiaginfo.cpp methods of note

CDxDiagInfo::CDxDiagInfo
CDxDiagInfo::Init
CDxDiagInfo::QueryDxDiagViaDll    
CDxDiagInfo::GetDisplayInfo

If you run the program it ouputs a giant list of values. I think the value you're interested in is pDisplayInfo->m_szDDStatusEnglish

like image 138
rwilliams Avatar answered Oct 18 '22 21:10

rwilliams