title: Is there a way to use PrintWindow with a control? (using AutoIt)
body: <p>I have this little piece of script but when I use PrintWindow it's only returning a black capture:</p>
  
  <p>PrintWindow() is working fine with a window handle but it's not with control handles.</p>
  
  <p>(Or is there a way to capture only the bottom part of the window or something in the middle without the need to capture the full window and cutting it?)</p>
  
  <p>AutoIt script:</p>
  
  <pre><code>Local $hWnd = ControlGetHandle("[CLASS:Notepad]","","Edit1")
  Local $pos = ControlGetPos($hWnd,"","")
  ;MsgBox($MB_OK, "OK", $pos[0])
  Local $Width = $pos[2]
  Local $Height = $pos[3]
  
  Local $hDC = _WinAPI_GetDC($hWnd)
  Local $memDC = _WinAPI_CreateCompatibleDC($hDC)
  Local $memBmp = _WinAPI_CreateCompatibleBitmap($hDC, $Width, $Height)
  _WinAPI_SelectObject ($memDC, $memBmp)
  ;DllCall("User32.dll","int","PrintWindow","hwnd",$hWnd,"hwnd",$memDC,"int",0)
  ;_WinAPI_BitBlt($hDC, 0, 0, $Width, $Height, $memDC, 0,0, $SRCCOPY)
  _WinAPI_BitBlt($memDC, 0, 0, $Width, $Height, $hDC, 0,0, $SRCCOPY) ;this is working now!
  
  _GDIPlus_Startup()
  Local $hBMP=_GDIPlus_BitmapCreateFromHBITMAP($memBmp)
  Local $hHBITMAP=_GDIPlus_BitmapCreateHBITMAPFromBitmap($hBMP)
  
  _WinAPI_DeleteObject($hDC)
  _WinAPI_ReleaseDC($hWnd, $hDC)
  _WinAPI_DeleteDC($memDC)
  _WinAPI_DeleteObject ($memBmp)
  _WinAPI_DeleteDC($hDC)
  
  $sPath = @ScriptDir &amp; '\capture.bmp'
  _WinAPI_SaveHBITMAPToFile($sPath, $hHBITMAP)
  </code></pre>