|
|
|
#1
|
||||
|
||||
|
You have correctly displayed the value of the main video card.
![]() Did not detect Intel (R) HD Graphics 4000 ![]() Did something go wrong with my adaptation? Or maybe the DXGI I used doesn't work for that. Code:
uses Windows, DXGI; //DXGI from link type TGPUInfo = record FName: String; FSize: Integer; end; TGPUs = array of TGPUInfo; procedure GetGPUs(out V: TGPUs); function Max(A, B: Integer): Integer; begin if A > B then Result := A else Result := B; end; function Align(Value, Size: Integer): Integer; begin if Value <> 0 then Result := (Max(0, Value div Size) + 1) * Size else Result := Value; end; var GPUInfo: TGPUInfo; i: Integer; riid: TGUID; hr: HRESULT; pFactory: IDXGIFactory; pAdapter: IDXGIAdapter; dxAdapterDesc: TDXGI_ADAPTER_DESC; begin riid := StringToGUID('{7b7166ec-21c7-44ae-b21a-c9ae321ae369}'); pFactory := nil; hr := CreateDXGIFactory(riid, pFactory); if (hr = S_OK) and Assigned(pFactory) then begin pAdapter := nil; i := 0; while (pFactory.EnumAdapters(i, pAdapter) = S_OK) do begin FillChar(dxAdapterDesc, SizeOf(TDXGI_ADAPTER_DESC), 0); hr := pAdapter.GetDesc(dxAdapterDesc); if hr = S_OK then begin GPUInfo.FName := dxAdapterDesc.Description; if dxAdapterDesc.DedicatedVideoMemory = 0 then GPUInfo.FSize := dxAdapterDesc.DedicatedSystemMemory div 1048576 else GPUInfo.FSize := dxAdapterDesc.DedicatedVideoMemory div 1048576; if GPUInfo.FSize < 512 then GPUInfo.FSize := Align(GPUInfo.FSize, 32) else GPUInfo.FSize := Align(GPUInfo.FSize, 512); SetLength(V, Length(V) + 1); V[Length(V) - 1] := GPUInfo; end; Inc(i); end; end; end; procedure TForm2.Button1Click(Sender: TObject); var i: Integer; MyGPUs: TGPUs; begin GetGPUs(MyGPUs); for i := Low(MyGPUs) to High(MyGPUs) do ShowMessage(MyGPUs[i].FName + ' (' + IntToStr(MyGPUs[i].FSize) + ' MB)'); end; |
| Sponsored Links |
|
#2
|
||||
|
||||
|
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 04:33. |
|
#3
|
||||
|
||||
|
Quote:
Only for that reason the matter continues. |
| The Following User Says Thank You to Cesar82 For This Useful Post: | ||
BLACKFIRE69 (31-05-2020) | ||
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Nero Plugin to burn mdf/mds images | Kall | CD/DVD Software & Utilities | 6 | 09-11-2007 03:29 |
| REQUEST : SDF plugin and AHX tool | --=FamilyGuy=-- | DC Games | 4 | 20-04-2007 14:13 |
| is there a a gamecube plugin to 3d studio max | gamesmell | GameCube Games | 1 | 13-03-2004 00:54 |
| FlaskMPEG & Panasonic Plugin: Plugin has "Fatal Error" | dan | CD/DVD Software & Utilities | 1 | 15-11-2000 17:23 |