如何设置机箱风扇速度 [英] How Do I Set case Fan Speed
本文介绍了如何设置机箱风扇速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建代码,在案例粉丝上设置速度,并且必须在Windows 7上工作。我尝试使用WMI代码创建者,但我收到错误无效的对象路径
I want create code which set speed on case fan and must working on windows 7. I try use WMI code creator but i got error " Invalid object path"
using System;
using System.Management;
using System.Windows.Forms;
namespace WMISample
{
public class CallWMIMethod
{
public static void Main()
{
try
{
ManagementObject classInstance =
new ManagementObject("root\\CIMV2",
"Win32_Fan.ReplaceKeyPropery='ReplaceKeyPropertyValue'",
null);
// Obtain in-parameters for the method
ManagementBaseObject inParams =
classInstance.GetMethodParameters("SetSpeed");
// Add the input parameters.
inParams["DesiredSpeed"] = 600;
// Execute the method and obtain the return values.
ManagementBaseObject outParams =
classInstance.InvokeMethod("SetSpeed", inParams, null);
// List outParams
Console.WriteLine("Out parameters:");
Console.WriteLine("ReturnValue: " + outParams["ReturnValue"]);
}
catch(ManagementException err)
{
MessageBox.Show("An error occurred while trying to execute the WMI method: " + err.Message);
}
}
}
}
有没有可能参考案例fan?
is there any possibility refer to case fan ?
推荐答案
并非每台机器都通过WMI提供此信息。如果您的计算机没有,您将无法访问它。仅仅因为WMI提供访问特定信息的属性并不意味着信息始终可用。
请参阅此链接以获取更多详细信息: http://stackoverflow.com/questions/15361471/im-using-win32-fan-to-get-and-display-my-cpu-fan-speed-but-its-not-working-why [ ^ ]
根据MSDN,Win32_Fan没有实现SetSpeed,所以你会得到
Not every machine provides this information through WMI. If your computer doesn't, you won't be able to access it. Just because WMI provides a property to access a particular piece of information doesn't mean that information will always be available.
Please refer this link for more details : http://stackoverflow.com/questions/15361471/im-using-win32-fan-to-get-and-display-my-cpu-fan-speed-but-its-not-working-why[^]
According to MSDN, SetSpeed is not implemented for Win32_Fan, so you will get the error at
classInstance.GetMethodParameters("SetSpeed");
Win32_Fan
可以在以下平台上提供信息
Windows Server 2012否
Windows Server 2008 R2否
Windows Server 2008否
Windows Server 2003是
Windows 8否
Windows 7否
Windows Vista否
Windows XP是
Windows 2000是
can retive information on following platforms
Windows Server 2012 No
Windows Server 2008 R2 No
Windows Server 2008 No
Windows Server 2003 Yes
Windows 8 No
Windows 7 No
Windows Vista No
Windows XP Yes
Windows 2000 Yes
如果WMI没有,那么我如何访问风扇并设置速度?
if WMI no, so how i can access to fan and set speed?
这篇关于如何设置机箱风扇速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文