Set Fan Speed in C#
c#, pinvoke
Solution
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);
}
Also here's a C++ method to do so. You could put that in a DLL and call it from your C# code
How can I control my PC's fan speed using C++ in Vista?
Problem
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 ); } ``` How can I set the computer's fan speed via c#?