控制台查看
CMD输入powercfg /a
显示如下有S0,则支持Modern Standby
注册表查看
Win+R 输入regedit进入注册表,
查看HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\ModernSleep路径下有否有参数EnabledActions=7
C++代码查看
#include <windows.h> #include <tchar.h> #include <powrprof.h> #include <iostream> using namespace std; #pragma comment(lib,"PowrProf.lib") int main(int argc, _TCHAR* argv[]) { SYSTEM_POWER_CAPABILITIES spc = {}; NTSTATUS status = CallNtPowerInformation(SystemPowerCapabilities, NULL, 0, &spc, sizeof(spc)); if (0 == status) { if (spc.AoAc)//return boolean type { // modern standby } } return 0; } |
---|
C#代码查看
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ThinkDPMAddin.Utils
{
public class WindowsApiTools
{
public struct SYSTEM_POWER_CAPABILITIES
{
// Misc supported system features
public bool PowerButtonPresent;
public bool SleepButtonPresent;
public bool LidPresent;
public bool SystemS1;
public bool SystemS2;
public bool SystemS3;
public bool SystemS4; // hibernate
public bool SystemS5; // off
public bool HiberFilePresent;
public bool FullWake;
public bool VideoDimPresent;
public bool ApmPresent;
public bool UpsPresent;
// Processors
public bool ThermalControl;
public bool ProcessorThrottle;
public byte ProcessorMinThrottle;
public byte ProcessorMaxThrottle;
public bool FastSystemS4;
public bool Hiberboot;
public bool WakeAlarmPresent;
public bool AoAc;
// Disk
public bool DiskSpinDown;
// HiberFile
public byte HiberFileType;
public bool AoAcConnectivitySupported;
public byte[] spare3;
// System Battery
public bool SystemBatteriesPresent;
public bool BatteriesAreShortTerm;
public BATTERY_REPORTING_SCALE[] BatteryScale;
// Wake
public SYSTEM_POWER_STATE AcOnLineWake;
public SYSTEM_POWER_STATE SoftLidWake;
public SYSTEM_POWER_STATE RtcWake;
public SYSTEM_POWER_STATE MinDeviceWakeState; // note this may change on driver load
public SYSTEM_POWER_STATE DefaultLowLatencyWake;
}
public enum SYSTEM_POWER_STATE
{
PowerSystemUnspecified = 0,
PowerSystemWorking = 1,
PowerSystemSleeping1 = 2,
PowerSystemSleeping2 = 3,
PowerSystemSleeping3 = 4,
PowerSystemHibernate = 5,
PowerSystemShutdown = 6,
PowerSystemMaximum = 7
}
public struct BATTERY_REPORTING_SCALE
{
UInt32 Granularity;
UInt32 Capacity;
}
[System.Runtime.InteropServices.DllImport("powrprof.dll", SetLastError = true)]
public static extern uint CallNtPowerInformation(
int InformationLevel,
IntPtr lpInputBuffer,
int nInputBufferSize,
out SYSTEM_POWER_CAPABILITIES spi,
int nOutputBufferSize
);
public static readonly int SYSTEMPOWERCAPABILITIES = 4;
public static bool GetIsSupportMSDB()
{
SYSTEM_POWER_CAPABILITIES spi;
uint retval = CallNtPowerInformation(
SYSTEMPOWERCAPABILITIES, IntPtr.Zero, 0, out spi,System.Runtime.InteropServices.Marshal.SizeOf(typeof(SYSTEM_POWER_CAPABILITIES))
);
if (0 == retval && spi.AoAc)
{
return true;// modern standby
}
return false;
}
}
}
关闭/开启机器的Modern Standby(前提是电脑支持,不然开了也没用)
close:创建*.reg后缀文件,复制下面文本放进去运行
Windows Registry Editor Version 5.00 [-HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\ModernSleep] [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power] "PlatformAoAcOverride"=dword:00000000 "CsEnabled"=dword:00000000 |
---|
open:创建reg后缀文件,复制下面文本放进去运行
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power] "CsEnabled"=- "PlatformAoAcOverride"=- [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\ModernSleep] "EnabledActions"=dword:00000007 |
---|
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)