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
KeithI've been programming with VB for 17 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
|