4
A
回答
2
您可以使用WMI訪問風扇轉速(以及其他統計信息,如溫度)。在Delphi中使用WMI的一個很好的例子是Magenta Systems。
+0
任何想法如何統一主板支持WMI這些天?我不知道答案 - 只是想知道。 – Argalatyr 2009-10-08 22:23:26
9
您可以使用WMI類德爾福Win32_TemperatureProbe和Win32_Fan, 必須導入微軟WMIScripting 1.x版庫使用成分 - >導入成分 - >導入類型庫 - >下一步 - >「選擇庫」 - >下一步 - >將單位添加到項目 - >完成。
請參閱此代碼。只是一個簡單的例子。
program GetWMI_Info;
{$APPTYPE CONSOLE}
uses
ActiveX,
Variants,
SysUtils,
WbemScripting_TLB in '..\..\..\Documents\RAD Studio\5.0\Imports\WbemScripting_TLB.pas';
procedure ShowTemperatureInfo();
var
WMIServices: ISWbemServices;
Root : ISWbemObjectSet;
Item : Variant;
I : Integer;
begin
{
http://msdn.microsoft.com/en-us/library/aa394493%28VS.85%29.aspx
The Win32_TemperatureProbe WMI class represents the properties of a temperature sensor (electronic thermometer).
Most of the information that the Win32_TemperatureProbe WMI class provides comes from SMBIOS.
Real-time readings for the CurrentReading property cannot be extracted from SMBIOS tables.
For this reason, current implementations of WMI do not populate the CurrentReading property.
The CurrentReading property's presence is reserved for future use.
}
Writeln('Temperature Info');
Writeln('----------------');
WMIServices := CoSWbemLocator.Create.ConnectServer('.', 'root\cimv2','', '', '', '', 0, nil);
Root := WMIServices.ExecQuery('Select * FROM Win32_TemperatureProbe','WQL', 0, nil);
for I := 0 to Root.Count - 1 do
begin
Item := Root.ItemIndex(I);
Writeln('Accuracy '+VarToStr(Item.Accuracy));
Writeln('Availability '+VarToStr(Item.Availability));
Writeln('Caption '+Item.Caption);
Writeln('Config Manager Error Code '+VarToStr(Item.ConfigManagerErrorCode));
Writeln('Config Manager User Config '+VarToStr(Item.ConfigManagerUserConfig));
Writeln('Creation Class Name '+VarToStr(Item.CreationClassName));
Writeln('Current Reading '+VarToStr(Item.CurrentReading));
Writeln('Description '+VarToStr(Item.Description));
Writeln('Device ID '+VarToStr(Item.DeviceID));
Writeln('Error Cleared '+VarToStr(Item.ErrorCleared));
Writeln('Error Description '+VarToStr(Item.ErrorDescription));
Writeln('Install Date '+VarToStr(Item.InstallDate));
Writeln('Is Linear '+VarToStr(Item.IsLinear));
Writeln('Last Error Code '+VarToStr(Item.LastErrorCode));
Writeln('Lower Threshold Critical '+VarToStr(Item.LowerThresholdCritical));
Writeln('Lower Threshold Fatal '+VarToStr(Item.LowerThresholdFatal));
Writeln('Lower Threshold NonCritical '+VarToStr(Item.LowerThresholdNonCritical));
Writeln('Max Readable '+VarToStr(Item.MaxReadable));
Writeln('Min Readable '+VarToStr(Item.MinReadable));
Writeln('Name '+VarToStr(Item.Name));
Writeln('Nominal Reading '+VarToStr(Item.NominalReading));
Writeln('Normal Max '+VarToStr(Item.NormalMax));
Writeln('Normal Min '+VarToStr(Item.NormalMin));
Writeln('PNP Device ID '+VarToStr(Item.PNPDeviceID));
Writeln('Power Management Capabilities '+VarToStr(Item.PowerManagementCapabilities));
Writeln('Power Management Supported '+VarToStr(Item.PowerManagementSupported));
Writeln('Resolution '+VarToStr(Item.Resolution));
Writeln('Status '+VarToStr(Item.Status));
Writeln('Status Info '+VarToStr(Item.StatusInfo));
Writeln('System Creation Class Name '+VarToStr(Item.SystemCreationClassName));
Writeln('System Name '+VarToStr(Item.SystemName));
Writeln('Tolerance '+VarToStr(Item.Tolerance));
Writeln('Upper Threshold Critical '+VarToStr(Item.UpperThresholdCritical));
Writeln('Upper Threshold Fatal '+VarToStr(Item.UpperThresholdFatal));
Writeln('Upper Threshold NonCritical '+VarToStr(Item.UpperThresholdNonCritical));
Writeln('');
end;
end;
procedure ShowCPUFanInfo();
var
WMIServices: ISWbemServices;
Root : ISWbemObjectSet;
Item : Variant;
I : Integer;
begin
{
http://msdn.microsoft.com/en-us/library/aa394146%28VS.85%29.aspx
The Win32_Fan WMI class represents the properties of a fan device in the computer system. For example, the CPU cooling fan.
}
Writeln('CPU FAN Info');
Writeln('----------------');
WMIServices := CoSWbemLocator.Create.ConnectServer('.', 'root\cimv2','', '', '', '', 0, nil);
Root := WMIServices.ExecQuery('Select * FROM Win32_Fan','WQL', 0, nil);
for I := 0 to Root.Count - 1 do
begin
Item := Root.ItemIndex(I);
Writeln('ActiveCooling '+VarToStr(Item.ActiveCooling));
Writeln('Availability '+VarToStr(Item.Availability));
Writeln('Caption '+VarToStr(Item.Caption));
Writeln('Config Manager ErrorCode '+VarToStr(Item.ConfigManagerErrorCode));
Writeln('Config Manager UserConfig '+VarToStr(Item.ConfigManagerUserConfig));
Writeln('Creation ClassName '+VarToStr(Item.CreationClassName));
Writeln('Description '+VarToStr(Item.Description));
Writeln('DesiredSpeed '+VarToStr(Item.DesiredSpeed));
Writeln('DeviceID '+VarToStr(Item.DeviceID));
Writeln('ErrorCleared '+VarToStr(Item.ErrorCleared));
Writeln('ErrorDescription '+VarToStr(Item.ErrorDescription));
Writeln('InstallDate '+VarToStr(Item.InstallDate));
Writeln('LastErrorCode '+VarToStr(Item.LastErrorCode));
Writeln('Name '+VarToStr(Item.Name));
Writeln('PNPDeviceID '+VarToStr(Item.PNPDeviceID));
Writeln('PowerManagement Capabilities '+VarToStr(Item.PowerManagementCapabilities));
Writeln('PowerManagement Supported '+VarToStr(Item.PowerManagementSupported));
Writeln('Status '+VarToStr(Item.Status));
Writeln('StatusInfo '+VarToStr(Item.StatusInfo));
Writeln('SystemCreation ClassName '+VarToStr(Item.SystemCreationClassName));
Writeln('SystemName '+VarToStr(Item.SystemName));
Writeln('VariableSpeed '+VarToStr(Item.VariableSpeed));
Writeln('');
end;
End;
begin
try
CoInitialize(nil);
ShowTemperatureInfo();
ShowCPUFanInfo();
Readln;
CoUninitialize;
except
on E:Exception do
Begin
CoUninitialize;
Writeln(E.Classname, ': ', E.Message);
Readln;
End;
end;
end.
相關問題
- 1. 控制風扇速度
- 2. 控制風扇轉速(CPU)
- 3. 如何在OS X上獲取CPU溫度和風扇速度?
- 4. 用python控制風扇速度並檢測pc的內部溫度?
- 5. 使用JButton控制風扇的速度
- 6. 吐溫移動速度控制
- 7. 如何使用OpenHardwareMonitor lib獲得CPU風扇速度?
- 8. 控制虛擬CPU的時鐘速度?
- 9. 使用開放式硬件監控器獲取CPU溫度
- 10. JavaScript速度監控工具?
- 11. iphone音頻速度控制編程
- 12. JavaScript:如何控制進度速度?
- 13. 控制程序中的計算速度
- 14. 開源軟件來控制電腦風扇轉速
- 15. 哪個python模塊用於讀取WINDOWS中的CPU溫度和處理器風扇速度..?
- 16. 如何獲得CPU溫度?
- 17. 從Delphi中讀取Windows中無WMI支持的芯片組的溫度和風扇速度
- 18. 攝氏溫度到華氏溫度計算器控制檯應用程序C#
- 19. 減速控制檯速度
- 20. 設置風扇速度在C#
- 21. Raspberry Pi CPU溫度
- 22. 如何在溫度/溼度> 26c,60%的情況下運行風扇?
- 23. 溫度程序
- 24. Web瀏覽器速度過快,如何控制速度?
- 25. 如何控制Jquery Testimonial速度
- 26. 如何控制動畫速度?
- 27. 如何控制動畫速度(requestAnimationFrame)?
- 28. 如何控制jquery動畫速度
- 29. 如何控制JCarousel Vertical Scroller速度?
- 30. 如何控制動畫GIF的速度?
你想用它做什麼? – 2009-10-08 18:23:35