Пример #1
0
//************************************************************************************
// D3DEnum_EnumerateDevices()
// Enumerates all drivers, devices, and modes. The callback function is
// called each device, to confirm that the device supports the feature
// set required by the app.
//************************************************************************************
HRESULT D3DEnum_EnumerateDevices(HRESULT(*AppConfirmFn)(DDCAPS *, D3DDEVICEDESC7 *))
{
	// Store the device enumeration callback function
	g_fnAppConfirmFn = AppConfirmFn;

	// Enumerate drivers, devices, and modes
	DirectDrawEnumerateEx(DriverEnumCallback, NULL,
	                      DDENUM_ATTACHEDSECONDARYDEVICES |
	                      DDENUM_DETACHEDSECONDARYDEVICES |
	                      DDENUM_NONDISPLAYDEVICES);

	// Make sure devices were actually enumerated
	if (0 == g_dwNumDevicesEnumerated)
	{
		DEBUG_MSG(_T("No devices and/or modes were enumerated!"));
		return D3DENUMERR_ENUMERATIONFAILED;
	}

	if (0 == g_dwNumDevices)
	{
		DEBUG_MSG(_T("No enumerated devices were accepted!"));
		DEBUG_MSG(_T("Try enabling the D3D Reference Rasterizer."));
		return D3DENUMERR_SUGGESTREFRAST;
	}

	return S_OK;
}
Пример #2
0
HRESULT CMonitorManager::EnumSysMonitors(void)
{
	m_MonitorList.clear();

	HRESULT hr;
	hr = DirectDrawEnumerateEx(DDEnumCallbackEx,
	                           this, 
	                           DDENUM_ATTACHEDSECONDARYDEVICES);

	return hr;
}
Пример #3
0
bool CMonitorInfo::GetMonitorGUID(HMONITOR hMon, GUID& MonGuid)
{
	MONGUID	mg;
	ZeroMemory(&mg, sizeof(mg));
	mg.Mon = hMon;	// tell callback which monitor to look for
	HRESULT	hr = DirectDrawEnumerateEx(GetGUIDCallback, &mg, 
		DDENUM_ATTACHEDSECONDARYDEVICES);
	if (FAILED(hr))
		return(FALSE);
	if (!mg.Valid)	// if callback didn't find the monitor
		return(FALSE);
	MonGuid = mg.Guid;	// pass monitor's GUID to caller
	return(TRUE);
}
Пример #4
0
dx5_driver * dx5_common_class::get_driver_list()
{
	//if (dx_driver_list) free_driver_list(dx_driver_list);//This function can be called more than once.
//but its the callers responsability to delete the list after use.
	dx_driver_list=0;
	if (!i4_dx5_check(DirectDrawEnumerateEx(dd_device_callback,0,
											DDENUM_ATTACHEDSECONDARYDEVICES|
											DDENUM_DETACHEDSECONDARYDEVICES|
											DDENUM_NONDISPLAYDEVICES)))
	{
		free_driver_list(dx_driver_list);
		dx_driver_list=0;
	}
	return dx_driver_list;
}
Пример #5
0
IDirectDraw2 * dx5_common_class::initialize_driver(dx5_driver * driver)
{
	if (!driver)
	{
		return 0;
	}

	dx5_ddraw=0;
	if (!i4_dx5_check(DirectDrawEnumerateEx(dd_create_callback,(void *)driver->DriverName,
											DDENUM_ATTACHEDSECONDARYDEVICES|DDENUM_DETACHEDSECONDARYDEVICES|DDENUM_NONDISPLAYDEVICES)))
	{
		return 0;
	}

	if (!dx5_ddraw)
	{
		MessageBox(NULL,"The DirectDraw Driver stored in the registry has failed or does not exist.\n"
						"Reverting to Default","Invalid Settings",MB_OK);
		ZeroMemory(&i4_win32_startup_options.guid_screen,sizeof(GUID));
		if (!i4_dx5_check(DirectDrawCreate(NULL,&dx5_ddraw,0)))
		{
			return 0;
		}
		;
	}
	;

	IDirectDraw2 * dd=0;
	if (!i4_dx5_check(dx5_ddraw->QueryInterface(IID_IDirectDraw2,(void * *)&dd)))
	{
		dx5_ddraw->Release();
		return 0;
	}

	dx5_ddraw->Release(); // we are only using DirectDraw2 interface, free this one

	return dd;
}