title: How to show a DirectX/VMR window on multiple monitors (all of them)
body: <p>I have got a legacy MFC program that <strong>plays a video using VMR9/DirectX 9</strong>. There is a request to add support for multiple monitors. The program window should <strong>extend to all available monitors</strong>. </p>
  
  <p>I am working on laptop (Dell Precision) with second monitor attached, also Dell. Both monitors, laptop and external, have the same resolution.
  When I am running my application, I am using the following code to define a total screen size:</p>
  
  <pre><code>CRect GetVirtualDesktopDimension()
  {
      CRect rectWhole;
      ::SetRect( rectWhole, 
                  ::GetSystemMetrics( SM_XVIRTUALSCREEN ),
                  ::GetSystemMetrics( SM_YVIRTUALSCREEN ),
                  ::GetSystemMetrics( SM_CXVIRTUALSCREEN ),
                  ::GetSystemMetrics( SM_CYVIRTUALSCREEN ) );
      return rectWhole;
  }
  </code></pre>
  
  <p>Then I do</p>
  
  <pre><code>    CRect myRect = GetVirtualDesktopDimension();
      myWindow-&gt;SetWindowPos(0, 0, 0, myRect.Width(), myRect.Height(), SWP_SHOWWINDOW);
  </code></pre>
  
  <p><strong>The result is absolutely weird</strong>: The window indeed takes the whole of both monitors, I have checked it with Spy. </p>
  
  <ul>
  <li>The left part, the part shown on the internal laptop
  monitor, is shown correctly. </li>
  <li>The right part, the part of the external monitor, is hidden.
  I just see the external monitor's desktop.</li>
  </ul>
  
  <p>However, if I do something like    </p>
  
  <pre><code>myWindow-&gt;SetWindowPos(0, 100, 100, myRect.Width(), myRect.Height(), SWP_SHOWWINDOW);
  </code></pre>
  
  <p>then things go the other way, </p>
  
  <ul>
  <li>the left part, shown on the internal laptop monitor, is black,  </li>
  <li>the right part, the part of the external monitor, is shown
  correctly.</li>
  </ul>
  
  <p><strong>EDIT 1</strong>
  Have checked it on a desktop computer with 3 attached monitors. The same problem remains, meaning it is not a specific graphic card/adapter issue.</p>
  
  <p>How can I solve this?</p>