centaurvv
11-03-2011, 15:05
Собственно, тема раскрывает основной вопрос. Скриншот видимого окна сделать возможно, а скрытого... думаю тоже, но как это сделать (кроме варианта сделать его видимым на долю секунды для снимка)?
В подтверждение добавлю такой пример:
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <GUIConstantsEx.au3>
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <WindowsConstants.au3>
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <IE.au3>
#Include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <ScreenCapture.au3>
$oIE = _IECreateEmbedded (http://dundats.mvps.org/help/html/libfunctions/_iecreateembedded.htm) ()
$hGui = GUICreate (http://www.autoitscript.com/autoit3/docs/functions/GUICreate.htm)("", 1000, 500,-1, -1)
GUICtrlCreateObj (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateObj.htm)($oIE, 0, 0, 990, 490)
_IENavigate (http://dundats.mvps.org/help/html/libfunctions/_ienavigate.htm) ($oIE, 'http://www.mail.ru')
GUISetState (http://www.autoitscript.com/autoit3/docs/functions/GUISetState.htm)() ;Окно открыто
_ScreenCapture_CaptureWnd (http://dundats.mvps.org/help/html/libfunctions/_screencapture_capturewnd.htm) (@DesktopDir (http://www.autoitscript.com/autoit3/docs/macros.htm#@desktopdir) & "\Окно_не_скрыто.jpg", $hGui) ;Делаю скриншот и сохраняю на рабочий стол "Окно_не_скрыто.jpg"
GUISetState (http://www.autoitscript.com/autoit3/docs/functions/GUISetState.htm)(@SW_HIDE (http://www.autoitscript.com/autoit3/docs/macros.htm#@sw_hide)) ;Скрываю окно
_ScreenCapture_CaptureWnd (http://dundats.mvps.org/help/html/libfunctions/_screencapture_capturewnd.htm) (@DesktopDir (http://www.autoitscript.com/autoit3/docs/macros.htm#@desktopdir) & "\Окно_скрыто.jpg", $hGui) ;Делаю скриншот и сохраняю на рабочий стол "Окно_скрыто.jpg"
GUISetState (http://www.autoitscript.com/autoit3/docs/functions/GUISetState.htm)()
While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) GUIGetMsg (http://www.autoitscript.com/autoit3/docs/functions/GUIGetMsg.htm)() <> $GUI_EVENT_CLOSE
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)
по моему, можно подвинуть окно за пределы экрана (координаты окна превосходящие разрешение монитора) и сделать снимок по хендлу. проверь, может поможет
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <IE.au3>
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <WinAPI.au3>
#Include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <ScreenCapture.au3>
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <GUIConstantsEx.au3>
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <WindowsConstants.au3>
$oIE = _IECreateEmbedded (http://dundats.mvps.org/help/html/libfunctions/_iecreateembedded.htm)()
$hGui = GUICreate (http://www.autoitscript.com/autoit3/docs/functions/GUICreate.htm)("", 1000, 500,-1, -1)
GUICtrlCreateObj (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateObj.htm)($oIE, 0, 0, 990, 490)
_IENavigate (http://dundats.mvps.org/help/html/libfunctions/_ienavigate.htm)($oIE, 'http://www.mail.ru')
GUISetState (http://www.autoitscript.com/autoit3/docs/functions/GUISetState.htm)() ;Окно открыто
_ScreenCapture_CaptureBackgrWnd(@DesktopDir (http://www.autoitscript.com/autoit3/docs/macros.htm#@desktopdir) & "\Окно_не_скрыто.jpg", $hGui) ;Делаю скриншот и сохраняю на рабочий стол "Окно_не_скрыто.jpg"
GUISetState (http://www.autoitscript.com/autoit3/docs/functions/GUISetState.htm)(@SW_HIDE (http://www.autoitscript.com/autoit3/docs/macros.htm#@sw_hide)) ;Скрываю окно
_ScreenCapture_CaptureBackgrWnd(@DesktopDir (http://www.autoitscript.com/autoit3/docs/macros.htm#@desktopdir) & "\Окно_скрыто.jpg", $hGui) ;Делаю скриншот и сохраняю на рабочий стол "Окно_скрыто.jpg"
GUISetState (http://www.autoitscript.com/autoit3/docs/functions/GUISetState.htm)()
While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) GUIGetMsg (http://www.autoitscript.com/autoit3/docs/functions/GUIGetMsg.htm)() <> $GUI_EVENT_CLOSE
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)
Func (http://www.autoitscript.com/autoit3/docs/keywords.htm#Func) _ScreenCapture_CaptureBackgrWnd($sFileName, $hWnd, $iWidth = -1, $iHeight = -1)
Local (http://www.autoitscript.com/autoit3/docs/keywords.htm#Local) $iOpt_WWD, $hActive, $aPos, $iH, $iW, $hDDC, $hCDC, $hBMP
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) Not (http://www.autoitscript.com/autoit3/docs/keywords.htm#Not) IsHWnd (http://www.autoitscript.com/autoit3/docs/functions/IsHWnd.htm)($hWnd) Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) Return (http://www.autoitscript.com/autoit3/docs/keywords.htm#Return) SetError (http://www.autoitscript.com/autoit3/docs/functions/SetError.htm)(1, 0, 0)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) Not (http://www.autoitscript.com/autoit3/docs/keywords.htm#Not) BitAND (http://www.autoitscript.com/autoit3/docs/functions/BitAND.htm)(WinGetState (http://www.autoitscript.com/autoit3/docs/functions/WinGetState.htm)($hWnd), 2) Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
$iOpt_WWD = Opt (http://www.autoitscript.com/autoit3/docs/functions/Opt.htm)("WinWaitDelay", 0)
$hActive = WinGetHandle (http://www.autoitscript.com/autoit3/docs/functions/WinGetHandle.htm)("[ACTIVE]")
$aPos = WinGetPos (http://www.autoitscript.com/autoit3/docs/functions/WinGetPos.htm)($hWnd)
WinMove (http://www.autoitscript.com/autoit3/docs/functions/WinMove.htm)($hWnd, "", -1500, -1500)
WinSetState (http://www.autoitscript.com/autoit3/docs/functions/WinSetState.htm)($hWnd, "", @SW_SHOW (http://www.autoitscript.com/autoit3/docs/macros.htm#@sw_show))
WinActivate (http://www.autoitscript.com/autoit3/docs/functions/WinActivate.htm)($hActive)
WinWaitActive (http://www.autoitscript.com/autoit3/docs/functions/WinWaitActive.htm)($hActive)
Opt (http://www.autoitscript.com/autoit3/docs/functions/Opt.htm)("WinWaitDelay", $iOpt_WWD)
ElseIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#ElseIf) BitAND (http://www.autoitscript.com/autoit3/docs/functions/BitAND.htm)(WinGetState (http://www.autoitscript.com/autoit3/docs/functions/WinGetState.htm)($hWnd), 16) Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
$iOpt_WWD = Opt (http://www.autoitscript.com/autoit3/docs/functions/Opt.htm)("WinWaitDelay", 0)
$hActive = WinGetHandle (http://www.autoitscript.com/autoit3/docs/functions/WinGetHandle.htm)("[ACTIVE]")
WinSetState (http://www.autoitscript.com/autoit3/docs/functions/WinSetState.htm)($hWnd, "", @SW_RESTORE (http://www.autoitscript.com/autoit3/docs/macros.htm#@sw_restore))
WinActivate (http://www.autoitscript.com/autoit3/docs/functions/WinActivate.htm)($hActive)
WinWaitActive (http://www.autoitscript.com/autoit3/docs/functions/WinWaitActive.htm)($hActive)
Opt (http://www.autoitscript.com/autoit3/docs/functions/Opt.htm)("WinWaitDelay", $iOpt_WWD)
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $iWidth = -1 Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) $iWidth = _WinAPI_GetWindowWidth (http://dundats.mvps.org/help/html/libfunctions/_winapi_getwindowwidth.htm)($hWnd)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $iHeight = -1 Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) $iHeight = _WinAPI_GetWindowHeight (http://dundats.mvps.org/help/html/libfunctions/_winapi_getwindowheight.htm)($hWnd)
$hDDC = _WinAPI_GetDC (http://dundats.mvps.org/help/html/libfunctions/_winapi_getdc.htm)($hWnd)
$hCDC = _WinAPI_CreateCompatibleDC (http://dundats.mvps.org/help/html/libfunctions/_winapi_createcompatibledc.htm)($hDDC)
$hBMP = _WinAPI_CreateCompatibleBitmap (http://dundats.mvps.org/help/html/libfunctions/_winapi_createcompatiblebitmap.htm)($hDDC, $iWidth, $iHeight)
_WinAPI_SelectObject (http://dundats.mvps.org/help/html/libfunctions/_winapi_selectobject.htm)($hCDC, $hBMP)
DllCall (http://www.autoitscript.com/autoit3/docs/functions/DllCall.htm)("User32.dll", "int", "PrintWindow", "hwnd", $hWnd, "hwnd", $hCDC, "int", 0)
_WinAPI_BitBlt (http://dundats.mvps.org/help/html/libfunctions/_winapi_bitblt.htm)($hCDC, 0, 0, $iW, $iH, $hDDC, 0, 0, 0x00330008)
_WinAPI_ReleaseDC (http://dundats.mvps.org/help/html/libfunctions/_winapi_releasedc.htm)($hWnd, $hDDC)
_WinAPI_DeleteDC (http://dundats.mvps.org/help/html/libfunctions/_winapi_deletedc.htm)($hCDC)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) IsArray (http://www.autoitscript.com/autoit3/docs/functions/IsArray.htm)($aPos) Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
WinMove (http://www.autoitscript.com/autoit3/docs/functions/WinMove.htm)($hWnd, "", $aPos[0], $aPos[1])
WinSetState (http://www.autoitscript.com/autoit3/docs/functions/WinSetState.htm)($hWnd, "", @SW_HIDE (http://www.autoitscript.com/autoit3/docs/macros.htm#@sw_hide))
ElseIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#ElseIf) IsHWnd (http://www.autoitscript.com/autoit3/docs/functions/IsHWnd.htm)($hActive) Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
WinSetState (http://www.autoitscript.com/autoit3/docs/functions/WinSetState.htm)($hWnd, "", @SW_MINIMIZE (http://www.autoitscript.com/autoit3/docs/macros.htm#@sw_minimize))
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $sFileName = "" Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) Return (http://www.autoitscript.com/autoit3/docs/keywords.htm#Return) $hBMP
_ScreenCapture_SaveImage (http://dundats.mvps.org/help/html/libfunctions/_screencapture_saveimage.htm)($sFileName, $hBMP, True (http://www.autoitscript.com/autoit3/docs/keywords.htm#True))
EndFunc (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndFunc)
centaurvv
13-03-2011, 16:26
по моему, можно подвинуть окно за пределы экрана »
к сожалению не проходит такой вариант... хотя идея"улыбает" своей простотой :)
Сделай так просто, как возможно, но не проще этого »
Как всегда все работает безупречно! Спасибо!
Осталось разобраться в работе кода... WinAPI+DLL пока немного сложны для понимания :(
к сожалению не проходит такой вариант »
Как всегда все работает безупречно! »
Этот вариант используется в моём коде ;)
к сожалению не проходит такой вариант... хотя идея"улыбает" своей простотой »
Этот вариант используется в моём коде »
centaurvv, http://www.valetudo.ru/redforum/images/smilies/sarcastic_hand.gif
centaurvv
14-03-2011, 05:14
:) я пробовал подвинуть окно за пределы экрана в своем коде - результат не удовлетворил, по поводу кода Creat0R я уже писал :), что далек от WinAPI+DLL.
Тогда спасибо обоим за помощь ;)
vBulletin v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.