Win32: how to determine if DirectDraw is enabled?

When used CachedBitmapsin GDIPlus , graphic damage appears if the Windows video "Hardware Acceleration" drops too much - so DirectDraw is disabled:

alt text http://i48.tinypic.com/10qeaeb.jpg

There are six levels of hardware acceleration:

  • Turn off all accelerations
  • Disable everything except basic accelerations. (By default, the server server )
  • Disable all DirectDraw and Direct3D accelerations, as well as all cursors and accelerated accelerations
  • Turn off all cursors and advanced drawing accelerations
  • Disable cursor and bitmap acceleration
  • All accelerations are enabled (by default on computers for desktop )

If DirectDraw is disabled, use DrawCachedBitmapin GDI + will result in graphic corruption. It’s enough for me to just use the slow DrawImage()API if DirectDraw is not enabled - but I should be able to detect that DirectDraw is disabled.

How can I programmatically check if DirectDraw is enabled ?


Question: how does dxdiag do this: alt text

see also

KB191660 - DirectDraw or Direct3D option is not available

+3
source share
3 answers

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

( SDK)\\++\Misc\DxDiagReport

dxdiaginfo.cpp

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

, . , , , pDisplayInfo->m_szDDStatusEnglish

+3

.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Video\{'some hex string'}\0000\Acceleration.Level

, , Video, .

Acceleration.Level Values ​​

  • 5
  • 4 , . ( ).
  • 3 DirectDraw Direct3D,
  • 2
  • 1
  • 0 ( )

:

/ . http://www.autoitscript.com/forum/topic/61185-hardware-acceleration/

0

IDirectDraw , . , , , GetCaps() TestCooperativeLevel().

LPDIRECTDRAW lpdd7 = NULL; // DirectDraw 7.0

// first initialize COM, this will load the COM libraries
// if they aren't already loaded
if (FAILED(CoInitialize(NULL)))
   {
   // error
   } // end if

// Create the DirectDraw object by using the
// CoCreateInstance() function
if (FAILED(CoCreateInstance(&CLSID_DirectDraw,
                         NULL, CLSCTX_ALL,
                         &IID_IDirectDraw7,
                         &lpdd7)))
   {
   // error
   }


// now before using the DirectDraw object, it must
// be initialized using the initialize method

if (FAILED(IDirectDraw7_Initialize(lpdd7, NULL)))
{
    // error
}

lpdd7->Release();
lpdd7 = NULL; // set to NULL for safety

// now that we're done with COM, uninitialize it
CoUninitialize();

, DirectDraw SDK. .

0

Source: https://habr.com/ru/post/1747579/


All Articles