1

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.

Community
  • 1
  • 1
Journeyman
  • 95
  • 9
  • is your app a desktop or a metro app ? – Yahia Sep 03 '12 at 16:55
  • @Yahia must be "metro" since he's running on ARM – Jim O'Neil Sep 03 '12 at 16:59
  • @JimO'Neil you are right of course... must have overread that... – Yahia Sep 03 '12 at 16:59
  • Actually, it's a desktop app. It's a standard C# Windows app that I run under the desktop. – Journeyman Sep 03 '12 at 17:05
  • @Journeyman see my answer below... not sure whether it fully applies to desktop apps... but to me it seems that either the event is not available (may be a driver issue of the specific model you are using) or it is some sort of permissions issue or it just is not available... – Yahia Sep 03 '12 at 17:09
  • Q: Would the SysInfo control help? http://msdn.microsoft.com/en-us/library/aa733698%28v=vs.60%29.aspx – paulsm4 Sep 03 '12 at 17:17
  • There's something seriously wrong with this question. ARM tablets that boot Windows 8 are not available yet. And you can't run your own desktop app on an ARM tablet, that capability is reserved to Microsoft exclusively, only "Metro" style apps are supported. There's something wrong with your time machine. – Hans Passant Sep 03 '12 at 19:41
  • 1
    @Hans Passant This scenario is a niche one - I'm working on a pre-release tablet that integrates one of my company's products. My application is a driver monitor that will be allowed to run as a desktop app in the release build. Just wanted to reassure you that I'm not from the future and I'm not smoking crack :) – Journeyman Sep 05 '12 at 07:56

0 Answers0