Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Catching WM_POWERBROADCAST message

Posted on 1998-08-17
1
Medium Priority
?
945 Views
Last Modified: 2013-11-20
I'm trying to write a program that when used on a laptop will be able to detect a change from AC to battery power by catching the WM_POWERBROADCAST message.  Using Spy++, I see the message being sent to my application.  In an overwrite of PreTranslateMessage, I am looking for WM_POWERBROADCAST and trying to display a message indicating the message has been caught.  However, this has yet to work.

What am I missing in order to catch this message -- does it have to be caught before PreTranslateMessage or what?

I'm using VC++ 5.0 under Win 95.

Thanks,
Mark
0
Comment
Question by:markparr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 23

Accepted Solution

by:
chensu earned 800 total points
ID: 1320938
Catch it in your main frame window as follows.

ON_MESSAGE(WM_POWERBROADCAST, OnPowerBroadcast)

LONG CMyFrameWnd::OnPowerBroadcast(UINT wParam, LONG lParam)
{
    //...
}

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question