Mike Harnad
December 2nd, 2005, 01:28 PM
I have a need to obtain information about the installed graphics card. I wrote a small utility that walks through the registry and grabs the card type, driver name and version. Is there a more direct way to obtain this information? An API call perhaps?
PS...I don't want to use OpenGL or DirectX functions to do this.
golanshahar
December 2nd, 2005, 04:54 PM
you can use:
::EnumDisplayDevices(..) (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/devcons_2303.asp)
::EnumDisplaySettings(..) (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/devcons_84oj.asp)
look at this sample code:
typedef BOOL (_stdcall *tEnumDisplayDevicesA)(LPCTSTR,DWORD,PDISPLAY_DEVICE,DWORD);
tEnumDisplayDevicesA pEnumDisplayDevicesA = 0;
HINSTANCE handle = ::LoadLibrary("User32.dll");
if ( handle )
pEnumDisplayDevicesA = (tEnumDisplayDevicesA)::GetProcAddress(handle, "EnumDisplayDevicesA");
if ( pEnumDisplayDevicesA )
{
DISPLAY_DEVICE DD={0};
DD.cb = sizeof( DISPLAY_DEVICE );
pEnumDisplayDevicesA(0,0,&DD,0);
DEVMODE DM={0};
DM.dmDriverExtra = sizeof(DEVMODE);
::EnumDisplaySettings((const char*)DD.DeviceName,ENUM_REGISTRY_SETTINGS,&DM);
}
if ( handle )
::FreeLibrary(handle);
hope it helps.
Cheers
Mike Harnad
December 5th, 2005, 09:14 AM
Thanks for the reply. However, it looks like those functions won't provide what I'm looking for.