您可以查询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();
不幸的是,SDK 中不再包含 DirectDraw 文档。您可能需要旧版本来获取示例和头文件。