Click here to Skip to main content
15,918,976 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: From one project to another Pin
Ștefan-Mihai MOGA29-Mar-06 1:29
professionalȘtefan-Mihai MOGA29-Mar-06 1:29 
GeneralRe: From one project to another Pin
Nicolai M29-Mar-06 1:36
Nicolai M29-Mar-06 1:36 
GeneralRe: From one project to another Pin
Ștefan-Mihai MOGA29-Mar-06 2:15
professionalȘtefan-Mihai MOGA29-Mar-06 2:15 
AnswerRe: From one project to another Pin
Stephen Hewitt29-Mar-06 1:45
Stephen Hewitt29-Mar-06 1:45 
AnswerRe: From one project to another Pin
Nicolai M31-Mar-06 8:09
Nicolai M31-Mar-06 8:09 
QuestionCustom CListCtrl Scrolling Pin
Dinu John29-Mar-06 0:35
Dinu John29-Mar-06 0:35 
AnswerRe: Custom CListCtrl Scrolling Pin
Gavin Taylor29-Mar-06 2:02
professionalGavin Taylor29-Mar-06 2:02 
QuestionHow to get notificaion when laptop switches from power to battery? Pin
Amarelia29-Mar-06 0:31
Amarelia29-Mar-06 0:31 
Hi
I have wrote one dialog based MFC application which i run on Windows 2000 Professional.

In this application i capture different windows messges. I want to do certaing things when the power cable is removed from laptop and it automatically switches to battery status. And again I want to get notification when power becomes available.

For this I use WM_POWERBROADCAST message. I have written one function as

LRESULT OnMessagePowerBroadcast(WPARAM wParam, LPARAM lParam);
Declared in my header file.

And applied as

LRESULT MyClass::OnMessagePowerBroadcast(WPARAM wParam, LPARAM lParam)
{
MessageBox("WM_POWERBROADCAST");
return 0;
}

BEGIN_MESSAGE_MAP(MyClass, CDialog)
ON_MESSAGE(WM_POWERBROADCAST, OnMessagePowerBroadcast)
END_MESSAGE_MAP()

Here I get notification whenever my laptop switches from power to battery. But the problem is : It shows me message box even when power get in. for this I use wParam and compare it with the given values, and I get PBT_APMPOWERSTATUSCHANGE all the time. How to distinguish that Power is in or power is out?

Right now it gives me same message as ( "WM_POWERBROADCAST")even when power is in and when it's out.

Any idea how to distinguish it?

Regards,


Mahesh
AnswerRe: How to get notificaion when laptop switches from power to battery? Pin
Nibu babu thomas29-Mar-06 0:52
Nibu babu thomas29-Mar-06 0:52 
GeneralRe: How to get notificaion when laptop switches from power to battery? Pin
Amarelia29-Mar-06 2:06
Amarelia29-Mar-06 2:06 
AnswerRe: How to get notificaion when laptop switches from power to battery? Pin
David Crow29-Mar-06 3:26
David Crow29-Mar-06 3:26 
QuestionChild Vs Popup Dialogs ? Pin
llp00na29-Mar-06 0:25
llp00na29-Mar-06 0:25 
AnswerRe: Child Vs Popup Dialogs ? Pin
Nibu babu thomas29-Mar-06 0:30
Nibu babu thomas29-Mar-06 0:30 
GeneralRe: Child Vs Popup Dialogs ? Pin
llp00na29-Mar-06 0:35
llp00na29-Mar-06 0:35 
GeneralRe: Child Vs Popup Dialogs ? Pin
Nibu babu thomas29-Mar-06 0:44
Nibu babu thomas29-Mar-06 0:44 
GeneralRe: Child Vs Popup Dialogs ? Pin
llp00na29-Mar-06 1:08
llp00na29-Mar-06 1:08 
AnswerRe: Child Vs Popup Dialogs ? Pin
Maximilien29-Mar-06 2:49
Maximilien29-Mar-06 2:49 
GeneralRe: Child Vs Popup Dialogs ? Pin
llp00na29-Mar-06 8:09
llp00na29-Mar-06 8:09 
QuestionHow Can I Read CakeWalk's wrk File Pin
akira3229-Mar-06 0:13
akira3229-Mar-06 0:13 
AnswerRe: How Can I Read CakeWalk's wrk File Pin
Ștefan-Mihai MOGA29-Mar-06 0:50
professionalȘtefan-Mihai MOGA29-Mar-06 0:50 
QuestionHow Can I Read Midi File? Pin
akira3229-Mar-06 0:12
akira3229-Mar-06 0:12 
AnswerRe: How Can I Read Midi File? Pin
Shoaib Patel29-Mar-06 0:25
Shoaib Patel29-Mar-06 0:25 
AnswerRe: How Can I Read Midi File? Pin
Shoaib Patel29-Mar-06 0:37
Shoaib Patel29-Mar-06 0:37 
GeneralRe: How Can I Read Midi File? Pin
akira3229-Mar-06 3:16
akira3229-Mar-06 3:16 
AnswerRe: How Can I Read Midi File? Pin
Ștefan-Mihai MOGA29-Mar-06 0:52
professionalȘtefan-Mihai MOGA29-Mar-06 0:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.