title: converting HBITMAP to byte array
body: <p>I'm working with some scanner api which returns a HANDLE to an image in BMP format(so it is said so in documentation). I'm trying to somehow get BITMAP from this handle, but for example this code doesn't work:</p>
  
  <pre><code>HANDLE handle = getHandleFromScanner();
  BITMAP bitmap;
  int u = GetObject(handle, sizeof(BITMAP), &amp;bitmap);
  </code></pre>
  
  <p>u is 0 here and getLastError() returns 6 which means that handle is invalid. But I cannot get any other handle except through <code>getHandleFromScanner()</code> function. </p>
  
  <p>May be some transformations should be done with this handle? any ideas? What is the proper way to work with bitmap handles? Or any simple api exists? Samples I found via google didn't help me. </p>
  
  <p>Thanks a lot.</p>