#46
|
||||
|
||||
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 |
#47
|
||||
|
||||
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. |
#48
|
||||
|
||||
Quote:
Only for that reason the matter continues. |
The Following User Says Thank You to Cesar82 For This Useful Post: | ||
BLACKFIRE69 (31-05-2020) |
#49
|
||||
|
||||
try this one, you can remove the DXGI code if you having issues and just use the registry. Should produce the same results.
Code:
uses Winapi.Windows, Winapi.DXGI, System.Win.Registry; type TGPUInfo = record FName: String; FSize: Integer; end; TGPUs = array of TGPUInfo; procedure GetGPUs(out V: TGPUs; UseDXGI: Boolean); function Align(Value, Size: Integer): Integer; begin if Value mod Size <> 0 then Result := Succ(Max(0, Value div Size)) * Size else Result := Value; end; const RegPath = 'SOFTWARE\Microsoft\DirectX\'; var GPUInfo: TGPUInfo; i, j, k, l: Integer; x: Int64; riid: TGUID; hr: HRESULT; pFactory: IDXGIFactory; pAdapter: IDXGIAdapter; dxAdapterDesc: DXGI_ADAPTER_DESC; Reg1: TRegIniFile; Reg2: TRegistry; SL: TStringList; mybool: Boolean; begin Reg1 := TRegIniFile.Create(KEY_READ or KEY_WOW64_64KEY); SL := TStringList.Create; Reg1.RootKey := HKEY_LOCAL_MACHINE; if Reg1.OpenKey(RegPath, False) then Reg1.ReadSections(SL); Reg1.Free; Reg2 := TRegistry.Create(KEY_READ or KEY_WOW64_64KEY); Reg2.RootKey := HKEY_LOCAL_MACHINE; if UseDXGI then 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(DXGI_ADAPTER_DESC), 0); hr := pAdapter.GetDesc(dxAdapterDesc); if hr = S_OK then begin GPUInfo.FName := dxAdapterDesc.Description; GPUInfo.FSize := IfThen(dxAdapterDesc.DedicatedVideoMemory = 0, dxAdapterDesc.DedicatedSystemMemory, dxAdapterDesc.DedicatedVideoMemory) shr 20; if dxAdapterDesc.DedicatedSystemMemory = 0 then for j := 0 to SL.Count - 1 do begin if Reg2.OpenKey(RegPath + SL[j], False) then begin if (Reg2.ReadString('Description') = GPUInfo.FName) then if Reg2.ReadBinaryData('DedicatedVideoMemory', x, x.Size) = x.Size then begin GPUInfo.FSize := x shr 20; break; end; Reg2.CloseKey; end; end; GPUInfo.FSize := Align(GPUInfo.FSize, IfThen(GPUInfo.FSize < 512, 32, 512)); Insert(GPUInfo, V, Length(V)); end; inc(i); end; end; end; for j := 0 to SL.Count - 1 do begin if Reg2.OpenKey(RegPath + SL[j], False) then begin mybool := True; for i := Low(V) to High(V) do begin if (Reg2.ReadString('Description') = V[i].FName) then begin mybool := False; break; end; end; if mybool then begin GPUInfo.FName := Reg2.ReadString('Description'); x := 0; if Reg2.ReadBinaryData('DedicatedVideoMemory', x, x.Size) = x.Size then x := x shr 20; if x = 0 then if Reg2.ReadBinaryData('DedicatedSystemMemory', x, x.Size) = x.Size then x := x shr 20; GPUInfo.FSize := x; GPUInfo.FSize := Align(GPUInfo.FSize, IfThen(GPUInfo.FSize < 512, 32, 512)); Insert(GPUInfo, V, Length(V)); end; end; Reg2.CloseKey; end; SL.Free; Reg2.Free; for i := Low(V) to High(V) do begin k := 0; for j := Low(V) to High(V) do if V[j].FSize >= k then begin k := V[i].FSize; l := j end; GPUInfo := V[i]; V[i] := V[l]; V[l] := GPUInfo; end; end; procedure TForm1.Button1Click(Sender: TObject); var i: Integer; MyGPUs: TGPUs; begin Memo1.Lines.Clear; GetGPUs(MyGPUs, True); for i := Low(MyGPUs) to High(MyGPUs) do Memo1.Lines.Add(MyGPUs[i].FName + ' (' + MyGPUs[i].FSize.ToString + ' MB)'); end; Last edited by Razor12911; 31-05-2020 at 06:43. |
The Following 4 Users Say Thank You to Razor12911 For This Useful Post: | ||
#50
|
||||
|
||||
Thanks @Razor12911
I just didn't understand one thing ... In your code above, the registration information overlaps the GDXI values (if parametter UseDXGI = true). Shouldn't there be an "end else" in place of "end;"? Code:
inc(i); end; end; end else for j := 0 to SL.Count - 1 do begin Thanks again Razor12911 for the code, it's working perfectly, especially the version using registry that also detects the ON-BOARD video card. Last edited by Cesar82; 01-06-2020 at 08:00. Reason: After explaining Razor12911 I removed the "end else" from my modified file. |
The Following User Says Thank You to Cesar82 For This Useful Post: | ||
BLACKFIRE69 (07-06-2020) |
#51
|
||||
|
||||
I made it to work like that for a reason. Remember you said your intel you was not detected. So after dxgi is done detecting gpus using its methods, if any gpus were missed then registry code adds the remaining gpus. This is why I didn’t use “else”.
But then you might say why not just get rid of dxgi if doesn’t detect all gpus. Here is why, registry skips gpus with names that have already been detected which means if SLi/Crossfire was used, registry method will not be able to detect this but dxgi will be able to. While dxgi has issues of detecting intel gpu, registry helps dxgi Plus we have no idea if the same registry idea works on older operating systems so it’s best to have both methods working together So you can see why both code have to exist because they nullify the disadvantages they both have, furthermore. Dxgi has issues detecting gpu size in x86 because the value type used in x86 has the same issue as with wmi adapterram where gpu over 4gb is misread. Tl;dr both code help mitigate their own disadvantages so the code works flawlessly Last edited by Razor12911; 01-06-2020 at 01:10. |
The Following User Says Thank You to Razor12911 For This Useful Post: | ||
Cesar82 (01-06-2020) |
#52
|
||||
|
||||
@Razor12911
Now I understand. Thanks! There will only be differences in the results checking or not DXGI if you use SLI/Crossfire. |
#53
|
||||
|
||||
![]() SysInfo Library 2 Added:
Thanks Cesar82, Razor12911 ... who helped. |
The Following 4 Users Say Thank You to BLACKFIRE69 For This Useful Post: | ||
bunti_o4u (07-06-2020), Harsh ojha (07-06-2020), Jiva newstone (07-06-2020), Razor12911 (07-06-2020) |
#54
|
||||
|
||||
Quote:
It seems to be working perfectly. For those who have Inno Setup 6 installed and do not have the knowledge to change the script and want to do the test, I attached to this post the script adapted for Inno Setup 6.0 or newer. |
The Following 3 Users Say Thank You to Cesar82 For This Useful Post: | ||
#55
|
||||
|
||||
retrieving directX version makes the setup to take more time then if directX is not added in script. pl look into it.
Last edited by bunti_o4u; 07-06-2020 at 23:42. |
#56
|
||||
|
||||
got it... 👍
|
#57
|
||||
|
||||
Soundcard is Realtek high definition audio but it is showing Nvidia high definition audio.
|
#58
|
|||
|
|||
did you plugin your woofer or earphone
|
#59
|
||||
|
||||
Headphones are always plugged in and working properly.
Last edited by bunti_o4u; 08-06-2020 at 06:44. |
#60
|
|||
|
|||
test your headphones if its really working
as I have same problem whenever I unplugin my earphone it shows |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Nero Plugin to burn mdf/mds images | Kall | CD/DVD Software & Utilities | 6 | 09-11-2007 02:29 |
REQUEST : SDF plugin and AHX tool | --=FamilyGuy=-- | DC Games | 4 | 20-04-2007 13:13 |
is there a a gamecube plugin to 3d studio max | gamesmell | GameCube Games | 1 | 12-03-2004 23:54 |
FlaskMPEG & Panasonic Plugin: Plugin has "Fatal Error" | dan | CD/DVD Software & Utilities | 1 | 15-11-2000 16:23 |