Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the installed video card ( Delphi)

Tags:

video

delphi

Looking for a way to find the installed video card (Chip) on a windows computer.

A solution that supports XP thru Win 7.

I am using Delphi 2010.

Thanks

like image 352
grant1842 Avatar asked Oct 19 '12 03:10

grant1842


People also ask

How do you find out what GPU is installed?

To find out what graphics card you have, open the Start menu or desktop search bar on your PC, start typing Device Manager, and select it when the option appears. You'll see an entry near the top for Display adapters. Click the drop-down arrow and the name and model of your GPU will appear right below.

How do I know my graphics card is working?

Open Windows' Control Panel, click "System and Security" and then click "Device Manager." Open the "Display Adapters" section, double click on the name of your graphics card and then look for whatever information is under "Device status." This area will typically say, "This device is working properly." If it does not ...


1 Answers

You can use the Win32_VideoController WMI class

Try this sample.

{$APPTYPE CONSOLE}

uses
  SysUtils,
  ActiveX,
  ComObj,
  Variants;

procedure  GetWin32_VideoControllerInfo;
const
  WbemUser            ='';
  WbemPassword        ='';
  WbemComputer        ='localhost';
  wbemFlagForwardOnly = $00000020;
var
  FSWbemLocator : OLEVariant;
  FWMIService   : OLEVariant;
  FWbemObjectSet: OLEVariant;
  FWbemObject   : OLEVariant;
  oEnum         : IEnumvariant;
  iValue        : LongWord;
begin;
  FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator');
  FWMIService   := FSWbemLocator.ConnectServer(WbemComputer, 'root\CIMV2', WbemUser, WbemPassword);
  FWbemObjectSet:= FWMIService.ExecQuery('SELECT Name,PNPDeviceID  FROM Win32_VideoController','WQL',wbemFlagForwardOnly);
  oEnum         := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant;
  while oEnum.Next(1, FWbemObject, iValue) = 0 do
  begin
    Writeln(Format('Name           %s',[String(FWbemObject.Name)]));// String
    Writeln(Format('PNPDeviceID    %s',[String(FWbemObject.PNPDeviceID)]));// String        
    Writeln;
    FWbemObject:=Unassigned;
  end;
end;


begin
 try
    CoInitialize(nil);
    try
      GetWin32_VideoControllerInfo;
    finally
      CoUninitialize;
    end;
 except
    on E:EOleException do
        Writeln(Format('EOleException %s %x', [E.Message,E.ErrorCode])); 
    on E:Exception do
        Writeln(E.Classname, ':', E.Message);
 end;
 Writeln('Press Enter to exit');
 Readln;      
end.
like image 136
RRUZ Avatar answered Nov 15 '22 00:11

RRUZ