PDA

View Full Version : Display Adapter Info


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*

RizlaUK
02-04-2008, 07:56 AM
as it happens im working on a WMI dll for my current project, give me a hour or 2 and it *should* be finished

hiddenhole
02-04-2008, 10:12 AM
Legend :):yes:yes

hiddenhole
02-04-2008, 07:18 PM
On that note, IR.. you guys should look at WMI support with your next release.

RizlaUK
02-05-2008, 10:00 AM
ok, im having a little trouble with this dll, it all works prefect when called from a pb application but im getting an error with AMS, but only after the first call

so the first call is error free, but if the same dll is called again after that then it crashes the AMS application, restart and again first call is ok,

im not sure what is causeing this at mo, it seems like the dll call is still active even after its returned to AMS, but in PB it works fine

so the best i can do for now is make a commandline exe that writes a text file from the WMI info, but thats what you already have so it would be no better,

i'll take another look at tonight and see if theres anything i can do

hiddenhole
02-06-2008, 05:04 PM
Apparently one can access the WMI through luaCOM plugin ??..iam currently looking into this further...will post any progress

RizlaUK
02-07-2008, 05:32 PM
Well, i gave up on the WMI route and opted for some windows registry API commands and this time i have a stable dll

i managed to get the information i require so im happy and i thought i would post it in case it will do the job for you

see screen cap for more info on what info it retrieves

hope it helps

heres a small example
-------------------------------------------------------------------------------------------------------
-- GetVideoInfo(Item,ShowText)
--
-- Item: 0 = Manufacturer
-- 1 = VideoDriver
-- 2 = VideoMemory
-- 3 = VideoDriverDLL
-- 4 = VideoDriverVersion
-- 5 = Width
-- 6 = Height
-- 7 = Depth
-- 8 = Frequency

-- ShowText: 0 = Dont show text
-- 1 = Do show text
------------------------------------------------------------------------------------------------------

strText=""
for i=1, 9 do
Item=i-1
ShowText=1
DLLReturn = DLL.CallFunction("AutoPlay\\Docs\\VideoCardInfoDLL.dll", "GetVideoInfo", Item..", "..ShowText, DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL);
strText=strText..DLLReturn.."\r\n"
end

result = Dialog.Message("Notice", strText, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);

hiddenhole
02-08-2008, 07:11 PM
Cheers, it does return some of the information i require.

Iam still playing with luaCOM...but at present it looks promising