private void btnTest_Click(object sender, EventArgs e) { double f = 59.26535897936; string r = FmtFloat(f); return; uint cpuThrottleMax = 5; uint ret = 0; ret = PowerAPI.PowerReadACValueIndex( IntPtr.Zero, ref _activePolicyGuid, ref _processSetSubGroupGuid, ref _processThrottleMaxGuid, ref cpuThrottleMax); cpuThrottleMax = 50; ret = PowerAPI.PowerWriteACValueIndex( IntPtr.Zero, ref _activePolicyGuid, ref _processSetSubGroupGuid, ref _processThrottleMaxGuid, cpuThrottleMax); ret = PowerAPI.PowerSetActiveScheme(IntPtr.Zero, ref _activePolicyGuid); MessageBox.Show(cpuThrottleMax.ToString()); }
private void SetProcessThrottleMax(uint setValue) { PowerAPI.PowerWriteACValueIndex( IntPtr.Zero, ref _activePolicyGuid, ref _processSetSubGroupGuid, ref _processThrottleMaxGuid, setValue); PowerAPI.PowerSetActiveScheme(IntPtr.Zero, ref _activePolicyGuid); }