在C#中设置风扇速度 [英] Set Fan Speed in C#

查看:521
本文介绍了在C#中设置风扇速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这已经被问过了, 但我似乎无法正常工作. 我打电话给以下人:

I know this has been asked before, but I just can't seem to get it working. I have called the following:

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

我已经尝试过了(我知道这很可悲,但是我发现的是最好的):

And I have tried this (I know it's pathetic, but its the best I found):

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

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

How can I set the computer's fan speed via c#?

推荐答案

您的PInvoke不应这样:

Shouldn't your PInvoke be something like that:

[DllImport("Cimwin32.dll")]
static extern uint32 SetSpeed(in uint64 sp);

private void button1_Click(object sender, EventArgs e)
{
           SetSpeed(300);
}

这也是一种C ++方法.您可以将其放在DLL中,然后从C#代码中调用

Also here's a C++ method to do so. You could put that in a DLL and call it from your C# code

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

这篇关于在C#中设置风扇速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆