SystemEvents.PowerModeChanged from windows service

B

Bandu

Hi,

I used SystemEvents.PowerModeChanged to monitor from WinForm
application and it work fine.

I put that code in to Windows service application and it not seem to
catch any power event.

Help please? How can I monitor power change event from service
application?

Regards,

Bandu
 
W

Willy Denoyette [MVP]

Bandu said:
Hi,

I used SystemEvents.PowerModeChanged to monitor from WinForm
application and it work fine.

I put that code in to Windows service application and it not seem to
catch any power event.

Help please? How can I monitor power change event from service
application?

Regards,

Bandu


PowerModeChanged events (like all other System event notifications) are not
dispatched to Windows Services.
You should have received an Exception when attaching the handler for this
event, please consult the SystemEvents docs in MSDN for details.
What you can do is use System.Management.ManagementEventWatcher and register
an Win32_PowerManagementEvent event handler, this works for all type of
applications in Windows.

Willy.
 
B

Bandu

PowerModeChanged events (like all other System event notifications) are not
dispatched to Windows Services.
You should have received an Exception when attaching the handler for this
event, please consult the SystemEvents docs in MSDN for details.
What you can do is use System.Management.ManagementEventWatcher and register
an Win32_PowerManagementEvent event handler, this works for all type of
applications in Windows.

Willy.

thainks Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top