I have written a C# application that monitors a device attached to an ARM tablet running Windows 8. The application needs to detect when the tablet is resuming from sleep, so that it can send a command to the attached device.
I have tried monitoring the Microsoft.Win32.SystemEvents.PowerModeChanged event, as per this question.
I have tried watching for WM_POWERBROADCAST messages, as per this question.
In both cases the application works fine on my Windows 7 desktop development PC. However, neither approach works when I run the application on my Windows 8 ARM tablet.
Do I need to watch for a different message in this case? Is there something else I could try to work around this problem?
UPDATE: I have since found that when I plug or unplug mains power I do actually get a WM_POWERBROADCAST message (power status change). I also get a SystemEvents.PowerModeChanged event. However I am still not receiving any suspend or resume power messages when going through a suspend/resume cycle.
UPDATE #2: I have since found a workaround for my particular situation that does not rely on power messages. But thanks to those who took the time to answer/comment.