delphi hibernate push and detect

2019-04-14 07:40发布

using Delphi5.

I have an app that starts with windows boot and I would like to Close and Start it on the Hibernate/Wake command.

I need to be able to detect if it is coming back from an Hibernate so I can run my app each time. I have a setting in the Registry where the User can choose to run only once per day.

I am guessing there is a windows Message or Registry entry that tells the machine that it is going into and coming back from an Hibernate.

Thoughts and suggestions?

Thanks for looking at this question.

1条回答
【Aperson】
2楼-- · 2019-04-14 08:07

You could achieve such application behaviour by listening for the WM_POWERBROADCAST message in your application. This message is sent to all running applications notifying that a power-management event has occurred. wParam part of this message is where you can check if the system is entering a suspended state(PBT_APMSUSPEND) or recovering from one(PBT_APMRESUMESUSPEND).

查看更多
登录 后发表回答