title: GetPixel is WAY too slow
body: <p>I have a bunch of squares and each has a specific identity/symbol I need to identify. So far I have something like:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;windows.h&gt;
  
  using namespace std;
  
  int main() {
      HDC dc = GetDC(0);
      COLORREF color;
      int sum, x, y;
  
      while (true) {
          sum = 0;
          Sleep(100);
          for (x = 512; x &lt; 521; x++) {
              for (y = 550; y &lt; 565; y++) {
                  color = GetPixel(dc, x, y);
                  sum = GetRValue(color) + GetBValue(color) + GetGValue(color);
              }
          }
          cout &lt;&lt; "SUM: " &lt;&lt; sum &lt;&lt; endl;
      }
  
      return 0;
  }
  </code></pre>
  
  <p>Obviously it only scans one block so far. The problem is somehow even though it's only just over 100 pixels, it takes an INSANELY long time. I can't even imagine what could be going on. It takes well over a second, maybe two seconds, for each repetition. What can I do? There has to be a faster way to do this. If I can't query individual pixels, would there be a way to get a region of the screen? The zone is not inside my program's window.</p>