日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

多种方式查看电脑是否支持Modern Standby

發(fā)布時(shí)間:2023/12/20 编程问答 62 豆豆
生活随笔 收集整理的這篇文章主要介紹了 多种方式查看电脑是否支持Modern Standby 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

控制臺(tái)查看

CMD輸入powercfg /a

顯示如下有S0,則支持Modern Standby

注冊(cè)表查看

Win+R 輸入regedit進(jìn)入注冊(cè)表,

查看HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\ModernSleep路徑下有否有參數(shù)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 featurespublic bool PowerButtonPresent;public bool SleepButtonPresent;public bool LidPresent;public bool SystemS1;public bool SystemS2;public bool SystemS3;public bool SystemS4; // hibernatepublic bool SystemS5; // offpublic bool HiberFilePresent;public bool FullWake;public bool VideoDimPresent;public bool ApmPresent;public bool UpsPresent;// Processorspublic bool ThermalControl;public bool ProcessorThrottle;public byte ProcessorMinThrottle;public byte ProcessorMaxThrottle;public bool FastSystemS4;public bool Hiberboot;public bool WakeAlarmPresent;public bool AoAc;// Diskpublic bool DiskSpinDown;// HiberFilepublic byte HiberFileType;public bool AoAcConnectivitySupported;public byte[] spare3;// System Batterypublic bool SystemBatteriesPresent;public bool BatteriesAreShortTerm;public BATTERY_REPORTING_SCALE[] BatteryScale;// Wakepublic 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 loadpublic 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;}} }

關(guān)閉/開啟機(jī)器的Modern Standby(前提是電腦支持,不然開了也沒用)

close:創(chuàng)建*.reg后綴文件,復(fù)制下面文本放進(jìn)去運(yùn)行

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:創(chuàng)建reg后綴文件,復(fù)制下面文本放進(jìn)去運(yùn)行

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

總結(jié)

以上是生活随笔為你收集整理的多种方式查看电脑是否支持Modern Standby的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。