1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
| //-----------------------------------------------------------------------------------------------------
// This code was generated by the Wmi Delphi Code Creator (WDCC) Version 1.9.9.350
// http://code.google.com/p/wmi-delphi-code-creator/
// Blog http://theroadtodelphi.wordpress.com/wmi-delphi-code-creator/
// Author Rodrigo Ruz V. (RRUZ) Copyright (C) 2011-2015
//-----------------------------------------------------------------------------------------------------
//
// LIABILITY DISCLAIMER
// THIS GENERATED CODE IS DISTRIBUTED "AS IS". NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED.
// YOU USE IT AT YOUR OWN RISK. THE AUTHOR NOT WILL BE LIABLE FOR DATA LOSS,
// DAMAGES AND LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING OR MISUSING THIS CODE.
//
//----------------------------------------------------------------------------------------------------
program GetWMI_Info;
{$APPTYPE CONSOLE}
uses
SysUtils,
ActiveX,
ComObj,
Variants;
// La classe Win32_Processor représente un périphérique qui est capable
// d'interpréter une séquence d'instructions machine sur un système Win32. Sur un
// ordinateur multiprocesseurs, il existe une instance de cette classe pour chaque
// processeur.
procedure GetWin32_ProcessorInfo;
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 * FROM Win32_Processor','WQL',wbemFlagForwardOnly);
oEnum := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant;
while oEnum.Next(1, FWbemObject, iValue) = 0 do
begin
Writeln(Format('AddressWidth %d',[Integer(FWbemObject.AddressWidth)]));// Uint16
Writeln(Format('Architecture %d',[Integer(FWbemObject.Architecture)]));// Uint16
Writeln(Format('Availability %d',[Integer(FWbemObject.Availability)]));// Uint16
Writeln(Format('Caption %s',[String(FWbemObject.Caption)]));// String
Writeln(Format('ConfigManagerErrorCode %d',[Integer(FWbemObject.ConfigManagerErrorCode)]));// Uint32
Writeln(Format('ConfigManagerUserConfig %s',[String(FWbemObject.ConfigManagerUserConfig)]));// Boolean
Writeln(Format('CpuStatus %d',[Integer(FWbemObject.CpuStatus)]));// Uint16
Writeln(Format('CreationClassName %s',[String(FWbemObject.CreationClassName)]));// String
Writeln(Format('CurrentClockSpeed %d',[Integer(FWbemObject.CurrentClockSpeed)]));// Uint32
Writeln(Format('CurrentVoltage %d',[Integer(FWbemObject.CurrentVoltage)]));// Uint16
Writeln(Format('DataWidth %d',[Integer(FWbemObject.DataWidth)]));// Uint16
Writeln(Format('Description %s',[String(FWbemObject.Description)]));// String
Writeln(Format('DeviceID %s',[String(FWbemObject.DeviceID)]));// String
Writeln(Format('ErrorCleared %s',[String(FWbemObject.ErrorCleared)]));// Boolean
Writeln(Format('ErrorDescription %s',[String(FWbemObject.ErrorDescription)]));// String
Writeln(Format('ExtClock %d',[Integer(FWbemObject.ExtClock)]));// Uint32
Writeln(Format('Family %d',[Integer(FWbemObject.Family)]));// Uint16
Writeln(Format('InstallDate %s',[String(FWbemObject.InstallDate)]));// Datetime
Writeln(Format('L2CacheSize %d',[Integer(FWbemObject.L2CacheSize)]));// Uint32
Writeln(Format('L2CacheSpeed %d',[Integer(FWbemObject.L2CacheSpeed)]));// Uint32
Writeln(Format('L3CacheSize %d',[Integer(FWbemObject.L3CacheSize)]));// Uint32
Writeln(Format('L3CacheSpeed %d',[Integer(FWbemObject.L3CacheSpeed)]));// Uint32
Writeln(Format('LastErrorCode %d',[Integer(FWbemObject.LastErrorCode)]));// Uint32
Writeln(Format('Level %d',[Integer(FWbemObject.Level)]));// Uint16
Writeln(Format('LoadPercentage %d',[Integer(FWbemObject.LoadPercentage)]));// Uint16
Writeln(Format('Manufacturer %s',[String(FWbemObject.Manufacturer)]));// String
Writeln(Format('MaxClockSpeed %d',[Integer(FWbemObject.MaxClockSpeed)]));// Uint32
Writeln(Format('Name %s',[String(FWbemObject.Name)]));// String
Writeln(Format('NumberOfCores %d',[Integer(FWbemObject.NumberOfCores)]));// Uint32
Writeln(Format('NumberOfLogicalProcessors %d',[Integer(FWbemObject.NumberOfLogicalProcessors)]));// Uint32
Writeln(Format('OtherFamilyDescription %s',[String(FWbemObject.OtherFamilyDescription)]));// String
Writeln(Format('PNPDeviceID %s',[String(FWbemObject.PNPDeviceID)]));// String
Writeln(Format('PowerManagementCapabilities %d',[Integer(FWbemObject.PowerManagementCapabilities)]));// Array of Uint16
Writeln(Format('PowerManagementSupported %s',[String(FWbemObject.PowerManagementSupported)]));// Boolean
Writeln(Format('ProcessorId %s',[String(FWbemObject.ProcessorId)]));// String
Writeln(Format('ProcessorType %d',[Integer(FWbemObject.ProcessorType)]));// Uint16
Writeln(Format('Revision %d',[Integer(FWbemObject.Revision)]));// Uint16
Writeln(Format('Role %s',[String(FWbemObject.Role)]));// String
Writeln(Format('SocketDesignation %s',[String(FWbemObject.SocketDesignation)]));// String
Writeln(Format('Status %s',[String(FWbemObject.Status)]));// String
Writeln(Format('StatusInfo %d',[Integer(FWbemObject.StatusInfo)]));// Uint16
Writeln(Format('Stepping %s',[String(FWbemObject.Stepping)]));// String
Writeln(Format('SystemCreationClassName %s',[String(FWbemObject.SystemCreationClassName)]));// String
Writeln(Format('SystemName %s',[String(FWbemObject.SystemName)]));// String
Writeln(Format('UniqueId %s',[String(FWbemObject.UniqueId)]));// String
Writeln(Format('UpgradeMethod %d',[Integer(FWbemObject.UpgradeMethod)]));// Uint16
Writeln(Format('Version %s',[String(FWbemObject.Version)]));// String
Writeln(Format('VoltageCaps %d',[Integer(FWbemObject.VoltageCaps)]));// Uint32
Writeln('');
FWbemObject:=Unassigned;
end;
end;
begin
try
CoInitialize(nil);
try
GetWin32_ProcessorInfo;
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. |
Partager