#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <WinApi.au3>
Local $hForm = GUICreate('', 400, 300)
GUISetBkColor(0xABCDEF)
GUICtrlCreateLabel('Привет!', 10, 10, 70, 20)
GUICtrlSetBkColor(-1, 0x00FF00)
Local $iCtrl = GUICtrlCreateLabel('', 150, 0, 130, 110, $SS_CENTERIMAGE + $SS_BITMAP)
GUICtrlSetBkColor(-1, 0xFF8000)
;~ GUISetState(@SW_SHOW, $hForm)
Local $hBmp = _WinCapture($hForm, 0, 0, 100, 80)
GUICtrlSendMsg($iCtrl, 0x0172, 0, $hBmp)
_WinAPI_DeleteObject($hBmp)
GUISetState(@SW_SHOW, $hForm)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
EndSwitch
WEnd
Func _WinCapture($hWnd, $iX = 0, $iY = 0, $iW = -1, $iH = -1)
Local $hDDC, $hCDC, $hBmp
If $iW = -1 Then $iW = _WinAPI_GetWindowWidth($hWnd)
If $iH = -1 Then $iH = _WinAPI_GetWindowHeight($hWnd)
$hDDC = _WinAPI_GetDC($hWnd)
$hCDC = _WinAPI_CreateCompatibleDC($hDDC)
$hBmp = _WinAPI_CreateCompatibleBitmap($hDDC, $iW, $iH)
_WinAPI_SelectObject($hCDC, $hBmp)
DllCall("User32.dll", "int", "PrintWindow", "hwnd", $hWnd, "hwnd", $hCDC, "int", 1)
_WinAPI_BitBlt($hCDC, 0, 0, $iW, $iH, $hDDC, $iX, $iY, $SRCCOPY)
_WinAPI_ReleaseDC($hWnd, $hDDC)
_WinAPI_DeleteDC($hCDC)
Return $hBmp
EndFunc ;==>_WinCapture