What is the JUCE way to detect WM_POWERBROADCAST messages?


#1

Our app needs to detect WM_POWERBROADCAST wParam=PBT_APMSUSPEND so that this will shutdown the app. I've looked for but not found a juce way to capture native messages such as this. 

I'm asking before I roll my own hidden window to capture these events which seems hackish. I'll have to roll my own solution on Mac too unless there's already a JUCE way to capture and handle OS power events. Is there?

Thanks,

Paul S...

 


#2

Surprisingly, JUCE doesn't handle these types of events...


#3

The only related forum discussion of this was pretty old, so I thought a new query was in order.

Jules, if you read this, one of my searches was 'WM_' to find forum posts about windows message handling. Your website search tool disallows queries with only 3 characters. In a website I maintained back in the day, I changed the search term minimum char limit to 2. This made the client happy since search found the necessary TLA's and the site suffered no ill affects.

Thanks for a great framework!

 


#4

Jules, if you read this, one of my searches was 'WM_' to find forum posts about windows message handling. Your website search tool disallows queries with only 3 characters. In a website I maintained back in the day, I changed the search term minimum char limit to 2. This made the client happy since search found the necessary TLA's and the site suffered no ill affects.

That's a good idea, and I changed the setting on the site now, but I didn't realise this would make it go off and re-index the whole site, so searches will be broken for at least a few hours while that task runs! doh!

Anyway.. no, haven't ever considered the power broadcast thing before. If there's an equivalent on other platforms then I guess it might be worth adding some kind of handler for it.