title: Gdiplus::Bitmap to BYTE array?
body: <p>Here's my attempt (ugly GDI+ <strong>and</strong> GDI mix...)</p>
  
  <pre><code>// ...
  BYTE               pixels[BMP_WIDTH * BMP_HEIGHT * BMP_BPP];
  HBITMAP            hBitmap;
  Gdiplus::Bitmap    cBitmap(BMP_WIDTH, BMP_HEIGHT, PixelFormat32bppRGB);
  Gdiplus::Graphics  cGraphics(&amp;cBitmap);
  Gdiplus::Pen       cPen(Gdiplus::Color(255, 255, 0, 0));
  
  cGraphics.DrawRectangle(&amp;cPen, 0, 0, cBitmap.GetWidth() - 1, cBitmap.GetHeight() - 1);
  
  // and here it get's real ugly, I'd like to change that...
  cBitmap.GetHBITMAP(Gdiplus::Color(255, 255, 255), &amp;hBitmap);
  GetBitmapBits(hBitmap, sizeof(pixels), pixels);
  // ...
  </code></pre>
  
  <p>Someone told me to use LockBits but I really didn't understand how. I tried it, but I failed so I'm not going to post that attempt, too.</p>