这是它在注册表中的存储位置:
[HKEY_CURRENT_USER\Control Panel\PowerCfg] "CurrentPowerPolicy"="2"
Power Scheme (Default="0")
"0" = Home/Office Desk
"1" = Portable/Laptop
"2" = Presentation
"3" = Always On
"4" = Minimal Power Management
"5" = Max Battery
Run Code Online (Sandbox Code Playgroud)
然后访问它:
RegistryKey key= Registry.CurrentUser.OpenSubKey("Control Panel\PowerCfg", true);
var value = key.GetValue("CurrentPowerPolicy", 0);
Run Code Online (Sandbox Code Playgroud)
还有一个名为 Policies 的键,它REG_BINARY存储所有特定信息。您可以使用此页面上的示例来阅读它:http://www.eggheadcafe.com/community/aspnet/2/13312/registry-access-for-regbinary-values.aspx