   Programming for Multiple Monitors
  hi, how can i find some document about programming for multiple monitors? And  suppose i have two video cards, each one supports 4 out, how can i control video outputs to appointed monitor ? Use Windows GDI? Where can i find example about this?   
  Direct3D supports multi-monitor since version 9, allowing you to enumerate the various devices. The way of doing this is a bit convoluted if you want.It essentially relies on getting an adapter count (which is a vidcard+monitor) and then enumerating the various DEVCAPS for each adapter. By checking MasterAdapterOrdinal, AdapterOrdinalInGroup and NumberOfAdaptersInGroup, you can build a tree of screens.In D3D10, you use IDXGIFactory::EnumAdapters. It seems that a D3D10 adapter is a "videocard only", with outputs (which sounds definetly better to me).I've also played a bit with the pure Windows-based approach. I don't remember exactly why did I not used it but it was all around HMONITOR.I don't remember more in this case so all I can do is point you to Enumeration and Display Control. Poking around the MSDN lib will likely give you what you need.I'd like to hear experiences of multi-device programming. It was SLOW back in the D3D9 era and I hope it improved.   ;  I don't use direct3d, for example, i use geforce 9600 gt, it supports 2 monitors, if i use windows gdi, can i change monitor's coordinate? for example, first monitor: left = 0, right = 1024, top = 0, bottom = 768. second monitor: left = 1025, top = 769, right = 2048, bottom = 1536. if this is feasible, which gdi functions can use?   ;  I happened to wrote a class for this once. You need to use EnumDisplayMonitors(). More information on MSDN here: http://msdn.microsoft.com/en-us/library/dd162610(VS.85).aspxThis is what I did (only valid parts included):Header file:#ifndef MONITORINSPECTOR_H#define MONITORINSPECTOR_H#include "IncludeWindows.h"#include <vector>class Bitmap;struct MonitorDesc{HMONITORhMonitor;//handle to monitor (for windows operations)intx0;//topleft xintx1;//bottomright xinty0;//topleft yinty1;//bottomright y};class MonitorInspector{public:MonitorInspector();unsigned intGetNumMonitors();MonitorDescGetMonitorDesc(unsigned int n);MonitorDescGetVirtualMonitorDesc();boolScreenshot(Bitmap *pBitmap);//takes screenshot of entire virtual monitorboolScreenshot(Bitmap *pBitmap, unsigned int nMonitorID);//takes screenshot of single monitorboolScreenshot(Bitmap *pBitmap, int nX0, int nY0, int nX1, int nY1);//takes screenshot of part of entire virtual monitorprotected:std::vector<MonitorDesc>m_veMonitors;MonitorDescm_miVirtualMonitor;private:static BOOL CALLBACK StaticMonitorCallback(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData);BOOL MonitorCallback(HMONITOR hMonitor, LPRECT lprcMonitor);};#endifSource file:MonitorInspector::MonitorInspector(){EnumDisplayMonitors(NULL, NULL, &StaticMonitorCallback, (LPARAM)this);m_miVirtualMonitor.hMonitor = NULL;m_miVirtualMonitor.x0= GetSystemMetrics(SM_XVIRTUALSCREEN);m_miVirtualMonitor.y0= GetSystemMetrics(SM_YVIRTUALSCREEN);m_miVirtualMonitor.x1= GetSystemMetrics(SM_CXVIRTUALSCREEN) + m_miVirtualMonitor.x0;m_miVirtualMonitor.y1= GetSystemMetrics(SM_CYVIRTUALSCREEN) + m_miVirtualMonitor.y0;}unsigned int MonitorInspector::GetNumMonitors(){return m_veMonitors.size();}MonitorDesc MonitorInspector::GetMonitorDesc(unsigned int n){return m_veMonitors.at(n);}MonitorDesc MonitorInspector::GetVirtualMonitorDesc(){return m_miVirtualMonitor;}BOOL CALLBACK MonitorInspector::StaticMonitorCallback(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData){//convert dwData to pointer to MonitorInspectorMonitorInspector *pInspector = reinterpret_cast<MonitorInspector*> (dwData);return pInspector->MonitorCallback(hMonitor, lprcMonitor);}BOOL MonitorInspector::MonitorCallback(HMONITOR hMonitor, LPRECT lprcMonitor){MonitorDesc newInfo;newInfo.hMonitor= hMonitor;newInfo.x0= lprcMonitor->left;newInfo.y0= lprcMonitor->top;newInfo.x1= lprcMonitor->right;newInfo.y1= lprcMonitor->bottom;m_veMonitors.push_back(newInfo);return TRUE;};  use nview can change display position, like 1 x 2, 2 x 1. can gdi do it?   ;  You could try using SoftTH. This is a software hack for DirectX that lets windows see multiple monitors as one large monitor.http://www.kegetys.net/SoftTH/   ;  EnumDisplaySettings and ChangeDisplaySettingsEx will let you change the position of each adapter/monitor pairing for the desktop.  You have to submit the change for each pair to the database, and then do a reset of all displays for it to take effect.   ;  if there are 2 * 2 monitors, i want to display 2 pictures, one in three monitors, id is 1-3, another in last monitor. how should i do it ?   ;  GetClientRect function, why the point(0, 0) is on the title bar area, not on the client area? How can i get every monitor's device context?   ;  Thanks all. I got something from you. :)   