问题
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:
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).
来源:https://stackoverflow.com/questions/16884308/delphi-hibernate-push-and-detect