Platform SDK: Windows GDI 
Enumeration and Display Control
To enumerate all the devices on the computer, call the EnumDisplayDevices function. The information that is returned also indicates which monitor is part of the desktop.To enumerate the devices on the desktop that intersect a clipping region, call EnumDisplayMonitors. This returns the HMONITOR handle for each monitor, which is used with GetMonitorInfo. To enumerate all the devices in the virtual screen, use EnumDisplayMonitors. as shown in the following code:EnumDisplayMonitors(NULL, NULL, MyInfoEnumProc, 0);To get information about a display device, use EnumDisplaySettings or EnumDisplaySettingsEx. The ChangeDisplaySettingsEx function is used to control the display devices on the computer. It can modify the configuration of the devices, such as specifying the position of a monitor on the virtual desktop and changing the bit depth of any display. Typically, an application does not use this function. To add a display monitor to a multiple-monitor system programmatically, set DEVMODE.dmFields to DM_POSITION and specify a position (using DEVMODE.dmPosition) for the monitor you are adding that is adjacent to at least one pixel of the display area of an existing monitor. To detach the monitor, set DEVMODE.dmFields to DM_POSITION and set DEVMODE.dmPelsWidth and DEVMODE.dmPelsHeight to zero. For each display device, the application can save information in the registry that describes the configuration parameters for the device, as well as location parameters. The application can also determine which displays are part of the desktop, and which are not, through the DISPLAY_DEVICE_ATTACHED_TO_DESKTOP flag in the DISPLAY_DEVICE structure. Once all the configuration information is stored in the registry, the application can call ChangeDisplaySettingsEx again to dynamically change the settings, with no restart required.