static void Main()
{
// Set the SystemEvents class to receive event notification when a user
// when display settings change.
SystemEvents.DisplaySettingsChanged += new
EventHandler(SystemEvents_DisplaySettingsChanged);
// For demonstration purposes, this application sits idle waiting for events.
Console.WriteLine("This application is waiting for system events.");
Console.WriteLine("Press <Enter> to terminate this application.");
Console.ReadLine();
}
private void SystemEvents_DisplaySettingsChanged(object sender, EventArgs e)
{
Console.WriteLine("Display setting change .");
}
i have created a windows service.when i restart the system and login then change the display setting it will not work and event is not fire but the service is runing.
when i restart the service then i change the display setting then display setting event fire.
i think SystemEvents.DisplaySettingsChanged may depend on some service.