procedure GetTemperature(var Airflow, HDA, Temperature: Integer);
var
objLocator: ISWbemLocator;
objServices: ISWbemServices;
objObjectSet: ISWbemObjectSet;
EnumSet: IEnumVariant;
SetVar: OleVariant;
Fetched: Cardinal;
objObject: ISWbemObject;
objProperty: ISWbemProperty;
v: OleVariant;
i: Integer;
begin
Airflow:=-1;
HDA:=-1;
Temperature:=-1;
objLocator:=CreateComObject(CLASS_SWbemLocator) as ISWbemLocator;
objServices:=objLocator.ConnectServer('', 'root\WMI', '', '', '', '', 0, nil);
objObjectSet:=objServices.ExecQuery('select * from MSStorageDriver_ATAPISmartData', 'WQL', 0, nil);
EnumSet:=IUnknown(objObjectSet._NewEnum) as IEnumVariant;
while EnumSet.Next(1, SetVar, Fetched)=S_OK do
begin
objObject:=IUnknown(SetVar) as ISWbemObject;
objProperty:=objObject.Properties_.Item('VendorSpecific', 0);
if (objProperty.CIMType=wbemCimtypeUint8) and objProperty.IsArray then
begin
v:=objProperty.Get_Value;
for i:=0 to ((VarArrayHighBound(v, 1)-1) div 12)-1 do
begin
if v[2+i*12]=190 then Airflow:=v[2+i*12+3];
if v[2+i*12]=194 then HDA:=v[2+i*12+3];
if v[2+i*12]=231 then Temperature:=v[2+i*12+3];
end;
end;
end;
end;
Ответов: 57
Рейтинг: 0
|
|||
без таймера ноль выдаёт а с таймером 255 , вот ещё вариант с делфи форума :
|
|||
карма: 0 |
|