Kylix
Tips

NEW TIPS
Database (135)
Files (612)
Forms (606)
Graphic (536)
IDE (456)
Indy (433)
Internet / LAN (590)
IntraWeb (443)
Kylix (447)
Math (561)
Misc (591)
Multimedia (496)
Objects/
ActiveX (503)

OpenTools API (438)
Printing (459)
Strings (583)
System (721)
VCL (586)

Search Tip
Top15
Add new Tip

Forum

...get the CPU name/ speed?
Author: Eduardo Teixeira
[ Print tip ]    

Tip Rating (1):  
     



// this code will get the cpu identifier from the windows registry

uses
  
Registry;

function CPUname: string;
var
  
Reg: TRegistry;
begin
  
CPUname := '';
  Reg := TRegistry.Create;
  try
    
Reg.RootKey := HKEY_LOCAL_MACHINE;
    if Reg.OpenKey('\Hardware\Description\System\CentralProcessor\0', False) then
      
CPUname := Reg.ReadString('Identifier');
  finally
    
Reg.Free;
  end;
end;

// this code will get the cpu speed from the windows registry

uses
  
Registry;

function GetCpuSpeed: string;
var
  
Reg: TRegistry;
begin
  
Reg := TRegistry.Create;
  try
    
Reg.RootKey := HKEY_LOCAL_MACHINE;
    if Reg.OpenKey('Hardware\Description\System\CentralProcessor\0', False) then
    begin
      
Result := IntToStr(Reg.ReadInteger('~MHz')) + ' MHz';
      Reg.CloseKey;
    end;
  finally
    
Reg.Free;
  end;
end;

Rate this tip:

poor
very good


Copyright © Torry's Delphi Pages Torry's Delphi Pages Maintained by Simon Grossenbacher Notes? Comments? Feel free to send... Copyright © 1996-2001