无忧启动论坛

标题: 有会用aardio代码的看看这个怎么写 [打印本页]

作者: 黑中见白    时间: 2022-12-23 14:35
标题: 有会用aardio代码的看看这个怎么写
https://learn.microsoft.com/zh-c ... tprocessinformation

PROCESS_POWER_THROTTLING_STATE PowerThrottling;
RtlZeroMemory(&PowerThrottling, sizeof(PowerThrottling));
PowerThrottling.Version = PROCESS_POWER_THROTTLING_CURRENT_VERSION;

//
// EcoQoS
// Turn EXECUTION_SPEED throttling on.
// ControlMask selects the mechanism and StateMask declares which mechanism should be on or off.
//

PowerThrottling.ControlMask = PROCESS_POWER_THROTTLING_EXECUTION_SPEED;
PowerThrottling.StateMask = PROCESS_POWER_THROTTLING_EXECUTION_SPEED;

SetProcessInformation(GetCurrentProcess(),
                      ProcessPowerThrottling,
                      &PowerThrottling,
                      sizeof(PowerThrottling));

作者: 黑中见白    时间: 2022-12-23 14:35
本帖最后由 黑中见白 于 2022-12-23 14:37 编辑

::KERNEL32.SetProcessInformation(句柄,?这个应该可以直接按进程句柄,设置EcoQoS模式
EcoQoS模式是win11特有的


作者: 黑中见白    时间: 2022-12-24 01:49
666...
作者: Jacen    时间: 2023-1-1 17:46
其实很简单,这样写就可以了:
  1. import process;

  2. var throttlingState = {
  3.     INT version = 1;
  4.     INT controlMask = 1;
  5.     INT stateMask = 1;
  6. }

  7. ::Kernel32.SetProcessInformation(
  8.     process(),4,throttlingState,raw.sizeof(throttlingState)
  9. );

复制代码
不过要同时设置一下进程优先级,任务管理器才会显示绿叶标志。

新版 aardio 里已经有这个范例,可以查看、切换效率模式。
范例位置:进程 / 效率模式

作者: nowayer    时间: 2023-12-4 06:31
提示: 作者被禁止或删除 内容自动屏蔽




欢迎光临 无忧启动论坛 (http://wuyou.net/) Powered by Discuz! X3.3