Что нового

Создание скриншота неактивного (скрытого) окна

Trans

Знающий
Сообщения
257
Репутация
6
Версия AutoIt: 3.3.6.1

Описание: Создание скриншота неактивного окна (GUISetState(@SW_HIDE))

Примечания: Надо, чтоб он дружил с этой функцией:
Код:
Func _Capt()
	Dim $aResult[1][4] = [['browserx', 'browsery', 'width', 'height']]
$iCount = 0
$iX = 5
$iY = 5
  $oIMGs = _IEImgGetCollection($oIE)
            ReDim $aResult[@extended + 1][4]
            For $oIMG In $oIMGs
                $iCount += 1
                For $i = 0 To 3
                    $aResult[$iCount][$i] = _IEPropertyGet($oIMG, $aResult[0][$i])
                Next
            Next
            If Not $iCount Then
                MsgBox(16, 'Error', 'Error')
                Exit
            EndIf
            ReDim $aResult[$iCount + 1][4]
            $iX_L = $aResult[1][0]-15
            $iY_L = $aResult[1][1]+113
            $iX_R = $aResult[$iCount][0] + $aResult[$iCount][2]
            $iY_B = $aResult[$iCount][1] + $aResult[$iCount][3]
            ;$aWinPos = WinGetPos($hGui)
            ;$aClient = WinGetClientSize($hGui)
            ;$iX_shift = $aWinPos[2] - $aClient[0]
            ;$iY_shift = $aWinPos[3] - $aClient[1]
            $iX_shift = _WinAPI_GetSystemMetrics($SM_CXFRAME) * 2
            ;$iY_shift = _WinAPI_GetSystemMetrics($SM_CYCAPTION) + $iX_shift
            $iY_shift = _WinAPI_GetSystemMetrics($SM_CYCAPTION) + _WinAPI_GetSystemMetrics($SM_CYFRAME) * 2
            _ScreenCapture_CaptureWnd(@ScriptDir & '\captcha.jpg', $WinIE, $iX_L + $iX_shift, $iY_L + $iY_shift, $iX_R + $iX_shift, $iY_B + $iY_shift, False)
EndFunc
Которую нам предоставил madmasles http://autoit-script.ru/index.php/topic,7235.msg49795.html#msg49795
 

Arei

Скриптер
Сообщения
938
Репутация
115
зачем,если он в файл сохраняется
Код:
@ScriptDir & '\captcha.jpg'
?
или я не прав?
 
Автор
T

Trans

Знающий
Сообщения
257
Репутация
6
Пытался сделать через _WinCapute, но что-то у меня не получилось:( делает скрин всего экрана:(
Код:
Func _WinCapture($hWnd, $iWidth = -1, $iHeight = -1)
    Local $iH, $iW, $hDDC, $hCDC, $hBMP

    If $iWidth = -1 Then $iWidth = _WinAPI_GetWindowWidth($hWnd)
    If $iHeight = -1 Then $iHeight = _WinAPI_GetWindowHeight($hWnd)

    $hDDC = _WinAPI_GetDC($hWnd)
    $hCDC = _WinAPI_CreateCompatibleDC($hDDC)
    $hBMP = _WinAPI_CreateCompatibleBitmap($hDDC, $iWidth, $iHeight)
    _WinAPI_SelectObject($hCDC, $hBMP)

    DllCall("User32.dll", "int", "PrintWindow", "hwnd", $hWnd, "hwnd", $hCDC, "int", 0)
    _WinAPI_BitBlt($hCDC, 0, 0, $iW, $iH, $hDDC, 0, 0, 0x00330008)

    _WinAPI_ReleaseDC($hWnd, $hDDC)
    _WinAPI_DeleteDC($hCDC)

    Return $hBMP
EndFunc   ;==>_WinCapture
 
Верх