How can I get monitor and display specs/properties? #TS
-
Hi all, I wish to programmatically determine the monitor frequency (in Hz), the video card name and its manufacturer and version. Any one has any clue? Is there anything similar to GetDeviceCaps...? (Where's the GetDeviceCapsEx when you need it!? :)) If you're saying WMI, then please show me how to use it cause I stumped big time... /T
-
Hi all, I wish to programmatically determine the monitor frequency (in Hz), the video card name and its manufacturer and version. Any one has any clue? Is there anything similar to GetDeviceCaps...? (Where's the GetDeviceCapsEx when you need it!? :)) If you're saying WMI, then please show me how to use it cause I stumped big time... /T
WMI code is fairly complex and involved. It is too complicated to make up a solution for this problem. There are numerous examples of WMI usage on code project, code guru and in MSDN. I have some code I used to interrogate system performance data, but it is quite different from what you will need. Here's a start from MSDN: Use this provider first:
class Win32_VideoSettings : CIM_VideoSetting
{
Win32_VideoController ref Element ;
CIM_VideoControllerResolution ref Setting ;
};Then interogate for the specific controller:
class Win32_VideoController : CIM_PCVideoController
{
uint16 AcceleratorCapabilities[] ;
string AdapterCompatibility ;
string AdapterDACType ;
uint32 AdapterRAM ;
uint16 Availability ;
string CapabilityDescriptions[] ;
string Caption ;
uint32 ColorTableEntries ;
uint32 ConfigManagerErrorCode ;
boolean ConfigManagerUserConfig ;
string CreationClassName ;
uint32 CurrentBitsPerPixel ;
uint32 CurrentHorizontalResolution ;
uint64 CurrentNumberOfColors ;
uint32 CurrentNumberOfColumns ;
uint32 CurrentNumberOfRows ;
uint32 CurrentRefreshRate ;
uint16 CurrentScanMode ;
uint32 CurrentVerticalResolution ;
string Description ;
string DeviceID ;
uint32 DeviceSpecificPens ;
uint32 DitherType ;
datetime DriverDate ;
string DriverVersion ;
boolean ErrorCleared ;
string ErrorDescription ;
uint32 ICMIntent ;
uint32 ICMMethod ;
string InfFilename ;
string InfSection ;
datetime InstallDate ;
string InstalledDisplayDrivers ;
uint32 LastErrorCode ;
uint32 MaxMemorySupported ;
uint32 MaxNumberControlled ;
uint32 MaxRefreshRate ;
uint32 MinRefreshRate ;
boolean Monochrome ;
string Name ;
uint16 NumberOfColorPlanes ;
uint32 NumberOfVideoPages ;
string PNPDeviceID ;
uint16 PowerManagementCapabilities[] ;
boolean PowerManagementSupported ;
uint16 ProtocolSupported ;
uint32 ReservedSystemPaletteEntries ;
uint32 SpecificationVersion ;
string Status ;
uint16 StatusInfo ;
string SystemCreationClassName ;
string SystemName ;
uint32 SystemPaletteEntries ;
datetime TimeOfLastReset ;
uint16 VideoArchitecture ;
uint16 VideoMemoryType ;
uint16 VideoMode ;
string VideoModeDescription ;
string VideoProcessor ;
};Hope this helps, Bill
-
WMI code is fairly complex and involved. It is too complicated to make up a solution for this problem. There are numerous examples of WMI usage on code project, code guru and in MSDN. I have some code I used to interrogate system performance data, but it is quite different from what you will need. Here's a start from MSDN: Use this provider first:
class Win32_VideoSettings : CIM_VideoSetting
{
Win32_VideoController ref Element ;
CIM_VideoControllerResolution ref Setting ;
};Then interogate for the specific controller:
class Win32_VideoController : CIM_PCVideoController
{
uint16 AcceleratorCapabilities[] ;
string AdapterCompatibility ;
string AdapterDACType ;
uint32 AdapterRAM ;
uint16 Availability ;
string CapabilityDescriptions[] ;
string Caption ;
uint32 ColorTableEntries ;
uint32 ConfigManagerErrorCode ;
boolean ConfigManagerUserConfig ;
string CreationClassName ;
uint32 CurrentBitsPerPixel ;
uint32 CurrentHorizontalResolution ;
uint64 CurrentNumberOfColors ;
uint32 CurrentNumberOfColumns ;
uint32 CurrentNumberOfRows ;
uint32 CurrentRefreshRate ;
uint16 CurrentScanMode ;
uint32 CurrentVerticalResolution ;
string Description ;
string DeviceID ;
uint32 DeviceSpecificPens ;
uint32 DitherType ;
datetime DriverDate ;
string DriverVersion ;
boolean ErrorCleared ;
string ErrorDescription ;
uint32 ICMIntent ;
uint32 ICMMethod ;
string InfFilename ;
string InfSection ;
datetime InstallDate ;
string InstalledDisplayDrivers ;
uint32 LastErrorCode ;
uint32 MaxMemorySupported ;
uint32 MaxNumberControlled ;
uint32 MaxRefreshRate ;
uint32 MinRefreshRate ;
boolean Monochrome ;
string Name ;
uint16 NumberOfColorPlanes ;
uint32 NumberOfVideoPages ;
string PNPDeviceID ;
uint16 PowerManagementCapabilities[] ;
boolean PowerManagementSupported ;
uint16 ProtocolSupported ;
uint32 ReservedSystemPaletteEntries ;
uint32 SpecificationVersion ;
string Status ;
uint16 StatusInfo ;
string SystemCreationClassName ;
string SystemName ;
uint32 SystemPaletteEntries ;
datetime TimeOfLastReset ;
uint16 VideoArchitecture ;
uint16 VideoMemoryType ;
uint16 VideoMode ;
string VideoModeDescription ;
string VideoProcessor ;
};Hope this helps, Bill
-
Hi Bill, I'm trying to get started with WMI, but I'm stuck. How do I start? Have you tried it or can you maybe point me to a working code sample somewhere? /T
http://msdn.microsoft.com/downloads/default.asp?URL=/code/sample.asp?url=/msdn-files/027/001/566/msdncompositedoc.xml Download the WMI sdk, its full of samples. You will need to do some reasearch on your own and learn about WMI and how it works. Try using the search engine on this site, codeguru and others. Learning to research a problem will server you well in the future. Thanks for the help, Bill