title: How to determine Canvas dimensions by knowing only its Handle?
body: <p>I would like to know width and height of canvas but I know only its HDC.</p>
  
  <p>I've tried with this code:</p>
  
  <pre><code>procedure TForm92.Button1Click(Sender: TObject);
  var
    hBitmap: HGDIOBJ;
    Header: TBitmapInfoHeader;
  begin
    hBitmap := GetCurrentObject(PaintBox1.Canvas.Handle, OBJ_BITMAP);
    GetObject(hBitmap, sizeof(TBitmapInfoHeader), @Header);
    ShowMessage(IntToStr(Header.biWidth));
  end;
  </code></pre>
  
  <p>However it does not return me the dimensions of PaintBox1's Canvas, instead I am getting the dimensions of the form on which the <code>PaintBox1</code> is placed.</p>
  
  <p>What am I doing wrong?</p>