View Single Post
  #14  
Old 31-05-2020, 03:26
felice2011's Avatar
felice2011 felice2011 is offline
Registered User
 
Join Date: Feb 2011
Location: italy
Posts: 836
Thanks: 357
Thanked 1,158 Times in 390 Posts
felice2011 is on a distinguished road
I don't understand the basics are here https://docs.microsoft.com/en-us/win...ideocontroller in the WMI class, because used DX structures, also I think that only the primary vga that is used is of interest.

Code:
        Name_GPU.Text = "GPU Name : " & GPU_Name()
        Ram_Adapter.Text = "VGA Memory : " & Format_Bytes(AdapterRAM)

...

    Private Function GPU_Name() As String
        'Info GPU
        Dim Name_GPU As String = ""
        Dim GPU As New ManagementObjectSearcher("SELECT Name FROM Win32_VideoController")
        For Each Info_GPU As ManagementObject In GPU.Get()
            Try
                Name_GPU = Info_GPU("Name").ToString()
                Exit For
            Catch ex As Exception
                Name_GPU = "?"
            End Try
        Next
        Return Name_GPU
    End Function

    Private Function AdapterRAM() As String
        'Info GPU
        Dim Adapter_RAM As String = ""
        Dim GPU As New ManagementObjectSearcher("SELECT AdapterRAM FROM Win32_VideoController")
        For Each Info_GPU As ManagementObject In GPU.Get()
            Try
                Adapter_RAM = Info_GPU("AdapterRAM").ToString()
                Exit For
            Catch ex As Exception
                Adapter_RAM = "?"
            End Try
        Next
        Return Adapter_RAM
    End Function

    Private Function Format_Bytes(ByVal Bytes_Convert As String) As String
        Dim Total_Convert As Double
        Try
            Select Case Bytes_Convert
                'Case Is >= 1073741824 'GB
                '    Total_Convert = CDbl(Bytes_Convert / 1073741824) 'GB
                '    Return FormatNumber(Total_Convert, 2) & " GBytes"
                Case Is >= 1048576 'To 1073741823
                    Total_Convert = CDbl(Bytes_Convert / 1048576) 'MB
                    Return FormatNumber(Total_Convert, 0) & " MBytes"
                Case 1024 To 1048575
                    Total_Convert = CDbl(Bytes_Convert / 1024) 'KB
                    Return FormatNumber(Total_Convert, 0) & " KBytes"
                Case 0 To 1023
                    Total_Convert = Bytes_Convert 'Bytes
                    Return FormatNumber(Total_Convert, 0) & " Bytes"
                Case Else
                    Return ""
            End Select
        Catch
            Return ""
        End Try
    End Function
__________________
≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈ ≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈
« I Mediocri Imitano, I Geni Copiano, Dio Crea & Distrugge » (Io Ridefinisco & Perfeziono le Loro Opere Rendendole Uniche)
≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈ ≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈
« Mediocrities Imitate, Genius Copy, God Creates & Destroys » (I Reconsider & Improve Their Works, Rending Them One And Only)

Last edited by felice2011; 31-05-2020 at 03:33.
Reply With Quote