title: How to capture part of the screen and save it to a BMP?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3291167/how-to-make-screen-screenshot-with-win32-in-c">how to make screen screenshot with win32 in c++?</a>  </p>
  </blockquote>
  
  
  
  <p>I am currently trying to create an application that saved a portion of the screen to a bmp. I have found <a href="http://msdn.microsoft.com/en-us/library/dd183370(v=vs.85).aspx" rel="nofollow noreferrer">BitBlt</a> but I really don't know what to do with it. I have tried searching for some answers but I still haven't found a clarifying one using C++.</p>
  
  <p>So, basically I want this function:</p>
  
  <pre><code>bool capturePartScreen(int x, int y, int w int, h, string dest){
      //Capture part of screen according to coordinates, width and height.
      //Save that captured image as a bmp to dest.
      //Return true if success, false if failure
  }
  </code></pre>
  
  <p>BitBlt:</p>
  
  <pre><code>BOOL BitBlt(
      __in  HDC hdcDest,
      __in  int nXDest,
      __in  int nYDest,
      //The three above are the ones I don't understand!
      __in  int nWidth,
      __in  int nHeight,
      __in  HDC hdcSrc,
      __in  int nXSrc,
      __in  int nYSrc,
      __in  DWORD dwRop
  );
  </code></pre>
  
  <p>What should that hdc be and how do I obtain the bmp?</p>