-
September 1st, 2008, 10:56 AM
#1
HandlerEx function and SERVICE_CONTROL_POWEREVENT
I'm experiencing a different behaviour from what is told in the docs:
In my HandlerEx function of my custom service (registered with RegisterServiceCtrlHandlerEx) when I intercept the control event SERVICE_CONTROL_POWEREVENT the DWORD dwEventType is not PBT_POWERSETTINGCHANGE as stated in docs but can be any of the event identifiers of the WM_POWERBROADCAST Message even when i try to reproduce one of the power change PBT_POWERSETTINGCHANGE should dealing with...
I suppose I'm doing something wrong, or not understanding docs well.
Last edited by Enrorr; September 1st, 2008 at 10:58 AM.
-
September 1st, 2008, 04:22 PM
#2
Re: HandlerEx function and SERVICE_CONTROL_POWEREVENT
Originally Posted by Enrorr
the DWORD dwEventType is not PBT_POWERSETTINGCHANGE as stated in docs ... I suppose I'm doing something wrong, or not understanding docs well.
I guess it is OS specific.
For 2K/XP/Server 2003 (in case of SERVICE_CONTROL_POWEREVENT):
- dwEventType parameter will be any of the values that could be pased in the wParam parameter of the WM_POWERBROADCAST message: http://msdn.microsoft.com/en-us/libr...47(VS.85).aspx
- lpEventData points to the data that comes in the lParam parameter of the WM_POWERBROADCAST message.
For Vista/Server 2008 (in case of SERVICE_CONTROL_POWEREVENT):
- dwEventType parameter may be set to PBT_POWERSETTINGCHANGE;
- in that case lpEventData points to POWERBROADCAST_SETTING structure:
http://msdn.microsoft.com/en-us/libr...23(VS.85).aspx
This is an ambiguous documentation. It should've said that it is only for Vista (that is what MSDN is now for).
Last edited by dc_2000; August 24th, 2009 at 03:39 AM.
-
September 2nd, 2008, 01:29 AM
#3
Re: HandlerEx function and SERVICE_CONTROL_POWEREVENT
Thank you, I should reached it by myself (me stupid).
I'll try to define WINVER and _WIN32_WINNT as 0x0600.
No real vista pc around here for miles
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|