gpt4 book ai didi

c# - 在 C# 中设置风扇速度

转载 作者:太空狗 更新时间:2023-10-29 20:37:17 25 4
gpt4 key购买 nike

我知道之前有人问过这个问题,但我似乎无法让它工作。我调用了以下内容:

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# 代码中调用它

How can I control my PC's fan speed using C++ in Vista?

关于c# - 在 C# 中设置风扇速度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10655263/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com