Radeon

Detect graphics card programmatically with Visual Basic

Find out the name of the graphics card

Is it possible to determine the name of the graphics card based on the .Net code? Yes, it is possible with WMI. However, you must refer to System.Management and import it.

Windows Management Instrumentation

WMI is a great library that contains the details of various components required to operate the system. Hard drive information, processor information, network components, and the list continue. It’s really easy to query the data if you know a little about how the data is organized.

Use WMI to get the graphics card name

A lot of information about hardware and operating systems can be queried with WMI. The data can be queried with ManagementObjectSearcher. It accepts two parameters. The first parameter specifies which section should be called up as an area. And the second parameter is the actual query, which is almost similar to the SQL query. When using ManagementObjectSearcher’s Get method, the result set is specified in a collection.

Source code

Imports System.Management

Public class Form1

Private Sub Button1_Click (ByVal Sender As System.Object, _

ByVal e As System.EventArgs) handles Button1.Click

MsgBox (GetGraphicsCardName ())

End sub

Private function GetGraphicsCardName () As String

Dim GraphicsCardName = String.Empty

To attempt

Dim WmiSelect As New ManagementObjectSearcher _

(“rootCIMV2”, “SELECT * FROM Win32_VideoController”)

For every WmiResults as ManagementObject in WmiSelect.Get ()

GraphicsCardName = WmiResults.GetPropertyValue (“Name”). ToString

If (Not String.IsNullOrEmpty (GraphicsCardName)) Then

Exit for

End if

Next

Catch err As ManagementException

MessageBox.Show (err.Message)

End experiment

Return of GraphicsCardName

End function

End class

Tags

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button
Close