Jump to content

  • Log In with Google      Sign In   
  • Create Account

Use EnumDisplaySettings with non-standard Device Name


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 gretty   Members   -  Reputation: 215

Like
0Likes
Like

Posted 08 February 2013 - 11:23 PM

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, 08 February 2013 - 11:25 PM.


Sponsor:

#2 Aressera   Members   -  Reputation: 1484

Like
0Likes
Like

Posted 09 February 2013 - 01:26 AM

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS