C#:在电源计划之间切换

发布于 2024-11-06 15:07:49 字数 149 浏览 0 评论 0原文

我正在创建一个 API,我想在电源计划之间切换

[平衡、高性能、动力 节电器]

,我的问题不在于代码,编码很容易,但我想知道在哪里可以找到这些电源平面.exe文件,甚至注册表中的值来修改它

i am creating an API and i want to switch between power plans

[Balanced , High performance , Power
saver]

, my problem isn`t on the code , coding is easy , but i want to know where can i find these power planes .exe files or even values in registry to modify it

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

厌味 2024-11-13 15:07:49

与 C# 分开,2011 年Raymond Chen 建议用户使用GUI,或者对于那些喜欢终端的人:

如果您使用的是 Vista 或更高版本,请从命令行运行:

powercfg -aliases

但是,这对我不起作用,因为-aliases 不是 Windows XP 上的有效开关。

编辑:或者,您可以使用此有用的 GUID 列表

Separate from C#, in 2011 Raymond Chen recommended that users use the GUI, or for those who prefer a terminal:

If you are using Vista or above, from the command line, run :

powercfg -aliases

However, this doesn't work for me as -aliases is not a valid switch on Windows XP.

EDIT: Or, you can just use this list of helpful GUIDs!

不可一世的女人 2024-11-13 15:07:49

虽然您当然可以使用 powercfg 等外部工具,但您也可以使用电源管理 API

http://msdn.microsoft.com/en-us/library/aa372711%28v=VS.85%29.aspx

或 Windows 管理工具 (WMI)

http://msdn.microsoft.com/en-us/library/dd904518%28v=VS.85%29.aspx

While you could certainly use an external tool like powercfg, you could just as well use the Power Management API

http://msdn.microsoft.com/en-us/library/aa372711%28v=VS.85%29.aspx

Or Windows Management Instrumenation (WMI)

http://msdn.microsoft.com/en-us/library/dd904518%28v=VS.85%29.aspx

多像笑话 2024-11-13 15:07:49

以下是电源管理 API 用法的示例: PowerManager.cs

Here is an example of Power Management API usage: PowerManager.cs

离鸿 2024-11-13 15:07:49

您可以从命令行使用 Powercfg 命令

You can use Powercfg command from command-line

云淡风轻 2024-11-13 15:07:49

您可以在 winnt.h SDK 头文件中找到它们。 VS2008 存储在 c:\program files\microsoft sdks\windows\v6.0a\include 中,VS2010 存储在 v7.0a 中。搜索“GUID_MAX_POWER_SAVINGS”即可找到:

// =========================================
// Define GUIDs which represent well-known power schemes
// =========================================
//

//
// Maximum Power Savings - indicates that very aggressive power savings measures will be used to help
//                         stretch battery life.
//
// {a1841308-3541-4fab-bc81-f71556f20b4a}
//
DEFINE_GUID( GUID_MAX_POWER_SAVINGS, 0xA1841308, 0x3541, 0x4FAB, 0xBC, 0x81, 0xF7, 0x15, 0x56, 0xF2, 0x0B, 0x4A );

//
// No Power Savings - indicates that almost no power savings measures will be used.
//
// {8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c}
//
DEFINE_GUID( GUID_MIN_POWER_SAVINGS, 0x8C5E7FDA, 0xE8BF, 0x4A96, 0x9A, 0x85, 0xA6, 0xE2, 0x3A, 0x8C, 0x63, 0x5C );

//
// Typical Power Savings - indicates that fairly aggressive power savings measures will be used.
//
// {381b4222-f694-41f0-9685-ff5bb260df2e}
//
DEFINE_GUID( GUID_TYPICAL_POWER_SAVINGS, 0x381B4222, 0xF694, 0x41F0, 0x96, 0x85, 0xFF, 0x5B, 0xB2, 0x60, 0xDF, 0x2E );

You'll find them in the winnt.h SDK header file. Stored in c:\program files\microsoft sdks\windows\v6.0a\include for VS2008, v7.0a for VS2010. Search for "GUID_MAX_POWER_SAVINGS" to find this:

// =========================================
// Define GUIDs which represent well-known power schemes
// =========================================
//

//
// Maximum Power Savings - indicates that very aggressive power savings measures will be used to help
//                         stretch battery life.
//
// {a1841308-3541-4fab-bc81-f71556f20b4a}
//
DEFINE_GUID( GUID_MAX_POWER_SAVINGS, 0xA1841308, 0x3541, 0x4FAB, 0xBC, 0x81, 0xF7, 0x15, 0x56, 0xF2, 0x0B, 0x4A );

//
// No Power Savings - indicates that almost no power savings measures will be used.
//
// {8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c}
//
DEFINE_GUID( GUID_MIN_POWER_SAVINGS, 0x8C5E7FDA, 0xE8BF, 0x4A96, 0x9A, 0x85, 0xA6, 0xE2, 0x3A, 0x8C, 0x63, 0x5C );

//
// Typical Power Savings - indicates that fairly aggressive power savings measures will be used.
//
// {381b4222-f694-41f0-9685-ff5bb260df2e}
//
DEFINE_GUID( GUID_TYPICAL_POWER_SAVINGS, 0x381B4222, 0xF694, 0x41F0, 0x96, 0x85, 0xFF, 0x5B, 0xB2, 0x60, 0xDF, 0x2E );
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文