How can I find the number of video frames set through a WMI call?

Does anyone know how to get Video Ram of PC from WMI call?

I've seen calls to the AdapterRAM property of the Win32_VideoController control object, but this only gives system memory and is not at all representative of video memory.

+1


source to share


4 answers


It turns out it was the adapter's RAM, and through an unfortunate match, the wrong conversion was used and given the system RAM ... on two different systems. Thanks for making us watch again.

For what it's worth, in a C # WinForms application:



int _ram = 0;

ManagementObjectSearcher searcher = new ManagementObjectSearcher("select AdapterRAM from Win32_VideoController");

foreach (ManagementObject mo in searcher.Get())
{
   var ram = mo.Properties["AdapterRAM"].Value as UInt32?;

   if (ram.HasValue)
   {
      _ram = ((int)ram/1048576);
   }
}

      

+7


source


From Microsoft Script Center Script under Hardware, then Video and Display, then Video Controller List Properties.

I would suggest that you might have to work something out between AdapterRAM and "VideoMemoryType"



On Error Resume Next

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery _
    ("Select * from Win32_VideoController")

For Each objItem in colItems
    For Each strCapability in objItem.AcceleratorCapabilities
        Wscript.Echo "Accelerator Capability: " & strCapability
    Next
    Wscript.Echo "Adapter Compatibility: " & objItem.AdapterCompatibility
    Wscript.Echo "Adapter DAC Type: " & objItem.AdapterDACType
    Wscript.Echo "Adapter RAM: " & objItem.AdapterRAM
    Wscript.Echo "Availability: " & objItem.Availability
    Wscript.Echo "Color Table Entries: " & objItem.ColorTableEntries
    Wscript.Echo "Current Bits Per Pixel: " & objItem.CurrentBitsPerPixel
    Wscript.Echo "Current Horizontal Resolution: " & _
        objItem.CurrentHorizontalResolution
    Wscript.Echo "Current Number of Colors: " & objItem.CurrentNumberOfColors
    Wscript.Echo "Current Number of Columns: " & objItem.CurrentNumberOfColumns
    Wscript.Echo "Current Number of Rows: " & objItem.CurrentNumberOfRows
    Wscript.Echo "Current Refresh Rate: " & objItem.CurrentRefreshRate
    Wscript.Echo "Current Scan Mode: " & objItem.CurrentScanMode
    Wscript.Echo "Current Vertical Resolution: " & _
        objItem.CurrentVerticalResolution
    Wscript.Echo "Description: " & objItem.Description
    Wscript.Echo "Device ID: " & objItem.DeviceID
    Wscript.Echo "Device Specific Pens: " & objItem.DeviceSpecificPens
    Wscript.Echo "Dither Type: " & objItem.DitherType
    Wscript.Echo "Driver Date: " & objItem.DriverDate
    Wscript.Echo "Driver Version: " & objItem.DriverVersion
    Wscript.Echo "ICM Intent: " & objItem.ICMIntent
    Wscript.Echo "ICM Method: " & objItem.ICMMethod
    Wscript.Echo "INF Filename: " & objItem.InfFilename
    Wscript.Echo "INF Section: " & objItem.InfSection
    Wscript.Echo "Installed Display Drivers: " & _
        objItem.InstalledDisplayDrivers
    Wscript.Echo "Maximum Memory Supported: " & objItem.MaxMemorySupported
    Wscript.Echo "Maximum Number Controlled: " & objItem.MaxNumberControlled
    Wscript.Echo "Maximum Refresh Rate: " & objItem.MaxRefreshRate
    Wscript.Echo "Minimum Refresh Rate: " & objItem.MinRefreshRate
    Wscript.Echo "Monochrome: " & objItem.Monochrome
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "Number of Color Planes: " & objItem.NumberOfColorPlanes
    Wscript.Echo "Number of Video Pages: " & objItem.NumberOfVideoPages
    Wscript.Echo "PNP Device ID: " & objItem.PNPDeviceID
    Wscript.Echo "Reserved System Palette Entries: " & _
        objItem.ReservedSystemPaletteEntries
    Wscript.Echo "Specification Version: " & objItem.SpecificationVersion
    Wscript.Echo "System Palette Entries: " & objItem.SystemPaletteEntries
    Wscript.Echo "Video Architecture: " & objItem.VideoArchitecture
    Wscript.Echo "Video Memory Type: " & objItem.VideoMemoryType
    Wscript.Echo "Video Mode: " & objItem.VideoMode
    Wscript.Echo "Video Mode Description: " & objItem.VideoModeDescription
    Wscript.Echo "Video Processor: " & objItem.VideoProcessor
Next

      

+3


source


ManagementObjectSearcher searcher = new ManagementObjectSearcher("select AdapterRAM from 

    Win32_VideoController");

                    foreach (ManagementObject mo in searcher.Get())
                    {                            

                        double MemorySize = Convert.ToDouble(mo.Properties["AdapterRAM"].Value) / 1048576;

                        return MemorySize.ToString();
                    }

      

+1


source


We've already gone down the path of the AdapterRAM property, but that only gave us system memory, which has nothing to do with Video Ram. Is there any other way to get video memory?

0


source







All Articles