skippyj777
06-23-2001, 02:03 PM
I would like to check the amount of video memory present on the video card. Here is the Visual Basic code that accomplishes this:
Dim controllers As Object
Dim controller As Object
Dim ram As Variant
Dim caption As Variant
Set controllers = GetObject("WinMgmts:").InstancesOf("Win32_VideoController")
MsgBox "Retrieved Win32_VideoController collection."
For Each controller In controllers
caption = controller.caption
If IsNull(ram) Then
MsgBox "Caption returned Null!"
Else
MsgBox "Caption = " & CStr(caption)
End If
ram = controller.AdapterRAM
If IsNull(ram) Then
MsgBox "AdapterRAM returned Null!"
Else
MsgBox "AdapterRAM = " & CStr(ram)
End If
Next
My problem is getting the "controllers" object. I cannot figure out how to do this. I have tried CreateOleObject(), CreateObject(), and GetActiveObject() in various ways and none of them work. How does Visual Basic's GetObject() work, and how can I create a Delphi version of it?
-Josh
Dim controllers As Object
Dim controller As Object
Dim ram As Variant
Dim caption As Variant
Set controllers = GetObject("WinMgmts:").InstancesOf("Win32_VideoController")
MsgBox "Retrieved Win32_VideoController collection."
For Each controller In controllers
caption = controller.caption
If IsNull(ram) Then
MsgBox "Caption returned Null!"
Else
MsgBox "Caption = " & CStr(caption)
End If
ram = controller.AdapterRAM
If IsNull(ram) Then
MsgBox "AdapterRAM returned Null!"
Else
MsgBox "AdapterRAM = " & CStr(ram)
End If
Next
My problem is getting the "controllers" object. I cannot figure out how to do this. I have tried CreateOleObject(), CreateObject(), and GetActiveObject() in various ways and none of them work. How does Visual Basic's GetObject() work, and how can I create a Delphi version of it?
-Josh