A1VBCode Forums

Dual View


http://www.a1vbcode.com/vbforums/Topic32158.aspx

By jon doe - 5/30/2014

Dear all,



I need help, I'm newbie for programming in vb6. I want to asking how to make our software can run with video card or detect video card, like prompter, thanks for your help
By Keithuk - 6/28/2014

Private Function GetVideoCardName() As String



Dim objWMIService As Object, Dim colDevices As Object

Dim objDevice As Object, Dim sTemp As String



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

Set colDevices = objWMIService.ExecQuery("Select Name, Caption, Description From Win32_VideoController")

For Each objDevice In colDevices

'try name first

sTemp = Trim$(objDevice.Name)

'if nothing then try caption

If Len(sTemp) = 0 Then sTemp = Trim$(objDevice.Caption)

'if still nothing then try description

If Len(sTemp) = 0 Then sTemp = Trim$(objDevice.Description)

Next

GetVideoCardName = sTemp



ExitPoint:

Set colDevices = Nothing

Set objWMIService = Nothing



End Function