EnumDisplayMonitors
lists all the monitors that are currently activated. However, it doesn\'t seem to return disabled ones (i.e. ones that have \'extend my des
Ok, so first you have to create a device context:
http://msdn.microsoft.com/en-us/library/dd183490(v=VS.85).aspx The following code will give you all monitors:
CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL)
Then you would call the DeviceContext's EnumDisplayDevices which will have a pointer to a DISPLAY_DEVICE structure that contains information about the display device's settings. http://msdn.microsoft.com/en-us/library/dd162609(v=VS.85).aspx
Per MSDN:
To query all display devices in the current session, call this function in a loop, starting with iDevNum set to 0, and incrementing iDevNum until the function fails. To select all display devices in the desktop, use only the display devices that have the DISPLAY_DEVICE_ATTACHED_TO_DESKTOP flag in the DISPLAY_DEVICE structure.
To get information on the display adapter, call EnumDisplayDevices with lpDevice set to NULL. For example, DISPLAY_DEVICE.DeviceString contains the adapter name.
To obtain information on a display monitor, first call EnumDisplayDevices with lpDevice set to NULL. Then call EnumDisplayDevices with lpDevice set to DISPLAY_DEVICE.DeviceName from the first call to EnumDisplayDevices and with iDevNum set to zero. Then DISPLAY_DEVICE.DeviceString is the monitor name.
To query all monitor devices associated with an adapter, call EnumDisplayDevices in a loop with lpDevice set to the adapter name, iDevNum set to start at 0, and iDevNum set to increment until the function fails. Note that DISPLAY_DEVICE.DeviceName changes with each call for monitor information, so you must save the adapter name. The function fails when there are no more monitors for the adapter.
I am not a C++ programmer, however I had to code some stuff for display way back in the day, and I was just trying to help with the little that I remember. I am a bit rusty on WINAPI.
Did you check the monitor display functions?
I am pretty sure that the MONITORINFOF_PRIMARY flag of the MONITORINFO structure specifies which monitor is the primary monitor. Any monitor that has MONITORINFO or MONITORINFOEX structure is a "useful" monitor.
http://msdn.microsoft.com/en-us/library/dd145065(v=VS.85).aspx
As far as what monitors are available this link allows you to check for those:
Get Monitor Info: http://msdn.microsoft.com/en-us/library/dd144942(v=VS.85).aspx
Enum Display Devices: http://msdn.microsoft.com/en-us/library/dd162609(VS.85).aspx
Display Device Structure: http://msdn.microsoft.com/en-us/library/dd183569(v=VS.85).aspx
The Display Device Structure has a "DISPLAY_DEVICE_ACTIVE" flag which indicates if the device is active.