I have a windows service (and Mac) and I want to detect if the system has just been sent to hibernate or sleep, and when it wakes, i want to know that it had just been to sleep. Is this possible in Xojo?
There may be a message sent to applications upon going into sleep. Our declare gurus will probably chime in.
I don’t believe there is any execution during sleep. If that is the case, you can use a timer to detect the app has been frozen, and for how long.
Yes, it is the of message you need to detect. This requires a declare.
Eugene Dakin has created a great book about Windows declares you can get from http://xojolibrary.com/
Add a WindowProc and listen for WM_POWERBROADCAST
Message information is listed here:
Eugene’s book is great but let us know if you get stuck.
Have a look at the HotKeyHelperWFS class in the Windows Functionality Suite. This class implements a listener that receives WM_HOTKEY window messages. You can easily modify it to receive WM_POWERBROADCAST messages.
Edit: I just noticed that most of the relevant code isn’t in HotKeyHelperWFS class, but in the WndProcHelpersWFS module.