I was hoping to get a call to suspended() when computer goes to sleep and a call to resumed() when computer wakes up from sleep. But I get not… Am I missing something?
One of the great things with JUCE is that you have the source code. You can either add logging or place breakpoints to help you debug this. There is a function called handlePowerBroadcast in juce_win32_Windowing.cpp, which handles calling suspended and resumed. It is called from peerWindowProc, which handles all the incoming Windows messages. This should help you understand if JUCE is somehow failing, or if the OS is not sending the expected messages, moving the solution forward.
Well, that helps narrow the issue. And, taking a quick look at the JUCE sources I do not see the OS call to enable this message. There seems to be two different calls for this, one for the ‘classic’ power modes (RegisterPowerSettingNotification), and one for the ‘modern’ power modes (RegisterSuspendResumeNotification). Unless there is another way that these messages can be enabled, JUCE is missing them.
A little further reading seems to indicate that the classic mode doesn’t need to be registered for some messages to make it through, but that a system that does the modern mode will require registration.
You are correct JUCE is missing RegisterSuspendResumeNotification
if I add RegisterSuspendResumeNotification(hwnd, DEVICE_NOTIFY_WINDOW_HANDLE);
in the file juce_win32_Windowing.cpp
inside the function
createWindow()
It starts to work