3

I am trying to track a HDMI monitor connection/removal using the below code. That DisplaySettingChanged event is however not triggered for most of the monitors. A HDMI monitor removal event is not raised most of the times.

Event registration:

 Microsoft.Win32.SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged;

Method:

private static void SystemEvents_DisplaySettingsChanged(object sender, EventArgs e)
{
    Console.WriteLine("Display settings changed.");
}

For example, using an Acer S240HL monitor I get an event when connecting and disconnecting the monitor via HDMI. But with a Dell SE2216H I get no event when disconnecting the monitor from the HDMI port.

Note: I am using Windows 10 Enterprise 2016 LTSB OS.

Arjun babu
  • 607
  • 2
  • 13
  • 42
  • 3
    Getting DisplaySettingsChanged would be more of an accident than intentional. Surely you'll need to pay attention to plug&play notifications. Google "wm_devicechange hdmi" for decent hits. – Hans Passant Oct 24 '17 at 13:29
  • Thanks for your reply Hans Passant. But WM_DISPLAYCHANGE also give the same issue. The HDMI monitor Arrival/Removal not invoked properly.same as I mentioned already... Acer S240HL monitor getting Arrival Removal Events.But Dell SE2216H Monitor not getting removal event.it gets only arrival events. But in Devcon utility give arrival/Removal properly for both monitors.Is there any way to get arrival/removal events using Devcon in C# WPF? – Arjun babu Oct 25 '17 at 14:12
  • WM_DEVICECHANGE is a very different notification from WM_DISPLAYCHANGE. – Hans Passant Oct 25 '17 at 16:04

0 Answers0