SystemEvents Class Example not working in Windows

Viewed 343

C#, Windows 10 x64, Services, SystemEvent Handling

On this page https://msdn.microsoft.com/en-us/library/microsoft.win32.systemevents(v=vs.110).aspx you see "Example 2" which shows a simple service for Windows which includes a hidden form for the message loop. There is a event handler for "UserPreferencesChanged" and "TimeChanged". (I also want to add "DisplaySettingsChanged" <--- which is the main reason I am looking into this)

I cannot get this service receiving events properly. For example, I get sporadic notifcations in the event log that Time has changed, but I do NOT get anything when change "user preferences" (like where they say changing mouse settings) and also absolutely nothing when I add "DisplaySettingsChanged" or "DisplaySettingsChanging"

(see: https://msdn.microsoft.com/en-us/library/microsoft.win32.systemevents.displaysettingschanged(v=vs.110).aspx)

Absolutely nothing. I have the service running and watch the event log (as the example tells me), I am changing screen resolutions etc. or mouse settings, nothing. I am stumped. Has ANYONE gottin this to work?

(Using C# in VS2015, one version I made with the "Windows Service" template and one other where I basically copy/pasted the example 1:1, both don't work)

Thanks!

0 Answers
Related