hiddenhole
02-04-2008, 07:47 AM
Wondering if there is a funtion available within APMS to get display adapter info.
I have a rather crude method now which uses WMI to retrieve the info, via a windows script and write this to a "mainfest" file (for the lack of a better term), i then reads said file using functions built into APMS.
But maybe someone else out there has a less crude method ??
This is my .vbs code
On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objOutFile = objFSO.OpenTextFile("C:\display.ifx", 8, True)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_DisplayControllerConfiguration")
For Each objItem in colItems
objOutFile.WriteLine "[DisplayAdapter]"
objOutFile.WriteLine "BitsPerPixel=" & objItem.BitsPerPixel
objOutFile.WriteLine "Horizontal Resolution=" & objItem.HorizontalResolution
objOutFile.WriteLine "Adapter=" & objItem.Name
objOutFile.WriteLine "VideoMode=" & objItem.VideoMode
Next
Which will output
[DisplayAdapter]
BitsPerPixel=32
Horizontal Resolution=1680
Adapter=GeForce 8800 GTS
VideoMode=1680 by 1050 pixels, True Color, 60 Hertz
Maybe someone with some DLL making skills can use the above *shrugs*
I have a rather crude method now which uses WMI to retrieve the info, via a windows script and write this to a "mainfest" file (for the lack of a better term), i then reads said file using functions built into APMS.
But maybe someone else out there has a less crude method ??
This is my .vbs code
On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objOutFile = objFSO.OpenTextFile("C:\display.ifx", 8, True)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_DisplayControllerConfiguration")
For Each objItem in colItems
objOutFile.WriteLine "[DisplayAdapter]"
objOutFile.WriteLine "BitsPerPixel=" & objItem.BitsPerPixel
objOutFile.WriteLine "Horizontal Resolution=" & objItem.HorizontalResolution
objOutFile.WriteLine "Adapter=" & objItem.Name
objOutFile.WriteLine "VideoMode=" & objItem.VideoMode
Next
Which will output
[DisplayAdapter]
BitsPerPixel=32
Horizontal Resolution=1680
Adapter=GeForce 8800 GTS
VideoMode=1680 by 1050 pixels, True Color, 60 Hertz
Maybe someone with some DLL making skills can use the above *shrugs*