//uses ...ActiveX, ComObj, Variants, windows;
procedure CPU2;
const
wbemFlagForwardOnly = $00000020;
var
FSWbemLocator : OLEVariant;
FWMIService : OLEVariant;
FWbemObjectSet: OLEVariant;
FWbemObject : Variant;
// OLEVariant;
oEnum : IEnumvariant;
iValue : PULONG;
//LongWord;
begin;
FSWbemLocator := CreateOleObject('
WbemScripting.SWbemLocator');
FWMIService := FSWbemLocator.ConnectServer('
localhost', '
root\cimv2', '
', '
');
FWbemObjectSet:= FWMIService.ExecQuery('
SELECT * FROM Win32_ComputerSystem','
WQL',wbemFlagForwardOnly);
oEnum := IUnknown(FWbemObjectSet._NewEnum)
as IEnumVariant;
while oEnum.Next(1, FWbemObject, iValue) = 0
do
begin
Form1.Memo1.lines.add(Format('
NumberOfLogicalProcessors : %d', [Integer(FWbemObject.NumberOfLogicalProcessors)]));
Form1.Memo1.lines.add(Format('
NumberOfProcessors : %d', [Integer(FWbemObject.NumberOfProcessors)]));
FWbemObject:=Unassigned;
end;
end;