用C#设置风扇速度

我知道之前有人问过,但我似乎无法让它发挥作用。 我打电话给以下人:

using System.Management; using System.Management.Instrumentation; using System.Runtime.InteropServices; 

我试过这个(我知道它很可悲,但它是我发现的最好的):

  [DllImport("Cimwin32.dll")] private void button1_Click(object sender, EventArgs e) { uint32 SetSpeed( //??? [in] uint64 300 ); } 

如何通过c#设置计算机的风扇速度?

你的PInvoke不应该是这样的:

 [DllImport("Cimwin32.dll")] static extern uint32 SetSpeed(in uint64 sp); private void button1_Click(object sender, EventArgs e) { SetSpeed(300); } 

这也是一个C ++方法。 您可以将它放在DLL中并从C#代码中调用它

如何在Vista中使用C ++控制PC的风扇速度?