• Advertisement
Sign in to follow this  

Use EnumDisplaySettings with non-standard Device Name

This topic is 1807 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello

 

Using C++ WinAPI, I have have found out a monitors' device name by inspecting the value DEV_BROADCAST_DEVICEINTERFACE.dbcc_name and I am attempting to use that device name inside the function EnumDisplaySettings() (the device name is the first parameter of that function).

My Problem: The function EnumDisplaySettings() always returns 0, ie, fails. I believe it fails because MSDN says the first parameter of EnumDisplaySettings() should be a DISPLAY_DEVICE.DeviceName returned from EnumDisplayDevices whereas my device name is from DEV_BROADCAST_DEVICEINTERFACE.dbcc_name.

Using DEV_BROADCAST_DEVICEINTERFACE.dbcc_name I get the device name \\?\DISPLAY#GSM3AD7#5&20a3f50d&0&UID513#{866519b5-3f07-4c97-b7df-24
c5d8a8ccb8}
for my second monitor whereas EnumDisplayDevices() gives me the device name \\.\DISPLAYV1.

Is it possible to use EnumDisplaySettings() where the 1st parameter is a device name retrieved from the function DEV_BROADCAST_DEVICEINTERFACE.dbcc_name?

The reason why I ask is: when a second monitor gets connected to the computer I want to change that monitors display settings. But upon monitor connection I am notified of its device name through DEV_BROADCAST_DEVICEINTERFACE.dbcc_name which (as I explained above) is a different name to what EnumDisplayDevices() returns for the exact same device. And I dont know how I could identify that second monitor by enumerating though all display devices using EnumDisplayDevices()? Any ideas how I could enumerate though all display devices using EnumDisplayDevices() and identify the correct monitor/device that was just connected to the computer?

Edited by gretty

Share this post


Link to post
Share on other sites
Advertisement

You could just keep a list of the connected display names in your program (from EnumDisplayDevices()) and then update the list whenever a display is added or removed, finding the names of any new devices by comparing to the old list. You can then EnumDisplaySettings() with the new device name.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement