delphi hibernate push and detect

我只是一个虾纸丫 提交于 2019-12-21 22:44:55

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!