如何让 Windows 从应用程序进入睡眠状态?

发布于 2024-09-30 17:31:24 字数 134 浏览 0 评论 0原文

我正在尝试制作一个可以让 Windows 7 进入睡眠状态的应用程序, 我一直在查看 WM_Messages,但似乎找不到一个可以完成这项工作的。

我可以使用 ether C++ 或 Delphi 来制作应用程序(如果有什么不同的话)。

Im trying to make an app that can put windows 7 to sleep,
I have been looking at WM_Messages, but cant seem to find one that does the jobb.

I can use ether C++ or Delphi to make the app if there it makes any difference.

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

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

发布评论

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

评论(2

执笔绘流年 2024-10-07 17:31:24

使用 SetSuspendState 函数,该函数位于 < powerprof.dll:

function SetSuspendState(hibernate, forcecritical, disablewakeevent: boolean): boolean;
    stdcall; external 'powrprof.dll' name 'SetSuspendState';

SetSuspendState(false, false, false); // stand by
SetSuspendState(true, false, false); // hibernate

Use SetSuspendState function which is in powrprof.dll:

function SetSuspendState(hibernate, forcecritical, disablewakeevent: boolean): boolean;
    stdcall; external 'powrprof.dll' name 'SetSuspendState';

SetSuspendState(false, false, false); // stand by
SetSuspendState(true, false, false); // hibernate
零時差 2024-10-07 17:31:24

我相信 MSDN 页面会有所帮助。

I believe this MSDN page will help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文