We help IT Professionals succeed at work.

Getting Pc Details

GilRil
GilRil asked
on
I have made a program in Delphi 3 which looks at Pc's and sends some information to a database, but i need the following information for all operating systems but do not know where to get it from, i know some is in the registry but how do i get it.

Modems names and drivers
Sound Card Name and drivers
Network Card name and type
Graphic card name and drivers.

Thank You
Steve
steve@gilril.co.uk
Comment
Watch Question

MathiasIT Specialist

Commented:
I have some sources to do this in Delphi but I have to look.

Listening...

Bye, TDS.

Commented:
I've used this before:

uses
  Registry;

procedure GetHardwareList(List: TStrings);
var
  S: TStrings;
  R: TRegistry;
  i: Integer;
begin
  S := TStringList.Create;
  try
    R := TRegistry.Create;
    try
      R.RootKey := HKEY_DYN_DATA;
      if R.OpenKeyReadOnly('Config Manager\Enum') then
      try
        R.GetKeyNames(S);
      finally
        R.CloseKey;
      end;
      for i := 0 to S.Count - 1 do
        if R.OpenKeyReadOnly('Config Manager\Enum\' + S[i]) then
        try
          try
            S[i] := R.ReadString('HardWareKey');
          except
            S[i] := '';
          end;
        finally
          R.CloseKey;
        end;
      R.RootKey := HKEY_LOCAL_MACHINE;
      List.Clear;
      for i := 0 to S.Count - 1 do
        if (S[i] <> '') and R.OpenKeyReadOnly('Enum\' + S[i]) then
        try
          try
            List.Add(R.ReadString('Class') + ': ' +
R.ReadString('DeviceDesc'));
          except
          end;
        finally
          R.CloseKey;
        end;
    finally
      R.Free;
    end;
  finally
    S.Free;
  end;
end;


GL
Mike
Look at this functions....




procedure TForm1.Button1Click(Sender: TObject);
 
  function GetNetworkDriveMappings(SList:TStrings):Integer;
  var
   I:Char;
   ThePath:String;
   MaxNetPathLen:DWord;
  begin
    SList.Clear;
    MaxNetPathLen:=MAX_PATH;
    SetLength(ThePath,MAX_PATH);
 
    for I := 'A' to 'Z' do
     if WNetGetConnection(PChar(''+I+':'),PChar(ThePath),
                          MaxNetPathLen)<>ERROR_NOT_CONNECTED then
     SList.Add(I+': '+ThePath);
 
     {Number of Networks conexions}
     Result := SList.Count;
  end;
begin
  GetNetworkDriveMappings(Listbox1.items);
end;




 
 
function DeviceBitsPerPixel: Integer;
var
   DC: HDC;
begin
   DC := GetDC(0);
   try
     Result := GetDeviceCaps(DC, PLANES) * GetDeviceCaps(DC, BITSPIXEL);
   finally
     ReleaseDC(0, DC);
   end;
end;
 
 
 
The function returns:
 
1.- Monocromo
4.- 16 Colors
8.- 256 Colors
16.- True color 16 bits
24.- True color 24 bits
32.- True color 32 bits
 

 
function GetComputerName : String;
var
   pcComputer : PChar;
   dwCSize    : DWORD;
begin
   dwCSize := MAX_COMPUTERNAME_LENGTH + 1;
   GetMem( pcComputer, dwCSize );
   try
      if Windows.GetComputerName( pcComputer, dwCSize ) then
         Result := pcComputer;
   finally
      FreeMem( pcComputer );
   end;
end;
 

//for the Screen Saver
procedure TForm1.Button1Click(Sender: TObject);
 
  function GetLongFileName(Const FileName : String) : String;
  var
    aInfo: TSHFileInfo;
  begin
    if SHGetFileInfo(PChar(FileName),0,aInfo,Sizeof(aInfo),SHGFI_DISPLAYNAME)<>0 then
       Result:= String(aInfo.szDisplayName)
    else
       Result:= FileName;
  end;
 
var
   Ini:TInifile;
   ScreenSaverFile:string;
begin
  Ini:=TInifile.Create('system.ini');
  ScreenSaverFile:=GetLongFileName(
    Ini.ReadString('boot','SCRNSAVE.EXE','No Available') );
  Ini.Free;
 
  Label1.Caption:=ScreenSaverFile;
 
end;
 

 
function GetUserName : String;
var
   pcUser   : PChar;
   dwUSize : DWORD;
begin
   dwUSize := 21;
   GetMem( pcUser, dwUSize );
   try
      if Windows.GetUserName( pcUser, dwUSize ) then
         Result := pcUser
   finally
      FreeMem( pcUser );
   end;
end;
 

//for get Windows version

procedure TForm1.Button1Click(Sender: TObject);
 
  const
    cOsUnknown : Integer = -1;
    cOsWin95 : Integer = 0;
    cOsWin98 : Integer = 1;
    cOsWin98SE : Integer = 2;
    cOsWinME : Integer = 3;
    cOsWinNT : Integer = 4;
    cOsWin2000 : Integer = 5;
    cOsWhistler : Integer = 6;
 
 
  function GetOSVersion : Integer;
  var
    osVerInfo : TOSVersionInfo;
    majorVer, minorVer : Integer;
  begin
    Result := cOsUnknown;
    osVerInfo.dwOSVersionInfoSize := SizeOf( TOSVersionInfo );
 
    if ( GetVersionEx( osVerInfo ) ) then
    begin
      majorVer := osVerInfo.dwMajorVersion;
      minorVer := osVerInfo.dwMinorVersion;
 
      case ( osVerInfo.dwPlatformId ) of
 
        VER_PLATFORM_WIN32_NT : { Windows NT/2000 }
        begin
          if ( majorVer <= 4 ) then Result := cOsWinNT
          else
          if ( ( majorVer = 5 ) and ( minorVer= 0 ) ) then Result := cOsWin2000
          else
          if ( ( majorVer = 5) and ( minorVer = 1 ) ) then Result := cOsWhistler
          else
          Result := cOsUnknown;
        end;
 
        VER_PLATFORM_WIN32_WINDOWS : { Windows 9x/ME }
        begin
          if ( ( majorVer = 4 ) and ( minorVer = 0 ) ) then Result := cOsWin95
 
          else
          if ( ( majorVer = 4 ) and ( minorVer = 10 ) ) then
          begin
            if ( osVerInfo.szCSDVersion[ 1 ] = 'A' ) then Result := cOsWin98SE
 
            else Result := cOsWin98;
           end
         else
          if ( ( majorVer = 4) and ( minorVer = 90 ) ) then Result := cOsWinME
 
          else Result := cOsUnknown;
        end;
 
      else
        Result := cOsUnknown;
      end; { Final del Case}
    end else Result := cOsUnknown; {Final del if}
  end;
 
 
  function GetOSName( OSCode : Integer ) : String;
  begin
    if ( OSCode = cOsUnknown ) then
      Result := '(sconosciuto)'
    else if ( OSCode = cOsWin95 ) then
      Result := 'Microsoft Windows 95'
    else if ( OSCode = cOsWin98 ) then
      Result := 'Microsoft Windows 98'
    else if ( OSCode = cOsWin98SE ) then
      Result := 'Microsoft Windows 98 Second Edition'
    else if ( OSCode = cOsWinME ) then
      Result := 'Microsoft Windows Millennium Edition'
    else if ( OSCode = cOsWinNT ) then
      Result := 'Microsoft Windows New Technology'
    else if ( OSCode = cOsWin2000 ) then
      Result := 'Microsoft Windows 2000 / NT 5'
    else
      Result := 'Microsoft Windows';
  end;
 
 
begin
  Caption:=GetOsName ( GetOSVersion );
end;
 

//Get the System Language
?
procedure TForm1.Button1Click(Sender: TObject);
 
  function LanguageSystem:string;
  var
   IdiomaID:LangID;
   Idioma: array [0..100] of char;
  begin
    {Get System ID}
    IdiomaID:=GetSystemDefaultLangID;
    {Get Languaje Name}
    VerLanguageName(IdiomaID,Idioma,100);
    Result:=String(Idioma);
  end;
 
begin
  Label1.Caption:=IdiomaDelSistema;
end;
 

Author

Commented:
How do i use your command GetHardwareList(List: TStrings);

Thank you.

Author

Commented:
Thanks for the code, i have most of these already, i need Modems names and drivers
Sound Card Name and drivers
Network Card name and type
Graphic card name and drivers.

Thank you again
Steve
GilRil:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
CERTIFIED EXPERT

Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQed and points refunded

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Thanks,

geobul
EE Cleanup Volunteer
This question is PAQed and 50 points refunded

YensidMod
Expert Exchange Moderator

Explore More ContentExplore courses, solutions, and other research materials related to this topic.