Hmm, ich habe noch die 1803 Version.
Funktioniert dieses Skript:
C
#include <Clipboard.au3>
#include <IE.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
;Coded by UEZ 2011 - beta version
If @OSBuild < 6000 Then Exit MsgBox(16, "Error!", "Script is running only on Vista+ os properly!", 10)
;https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/general-info/ee330730(v=vs.85)
RegRead("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", @ScriptName)
If @error Then RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", @ScriptName, "REG_DWORD", 11001)
Global Const $hDwmApiDll = DllOpen("dwmapi.dll")
Global $sChkAero = DllStructCreate("int;")
DllCall($hDwmApiDll, "int", "DwmIsCompositionEnabled", "ptr", DllStructGetPtr($sChkAero))
Global $aero = DllStructGetData($sChkAero, 1)
DllClose($hDwmApiDll)
If Not $aero Then Exit MsgBox(16, "Error", "Aero must be enabled to grab web sites properly!", 20)
$sChkAero = 0
Global $URL, $btn, $msg, $hWnd, $input, $i
$hWnd = GUICreate("Save Web Page as an image", 320, 120)
$input = GUICtrlCreateInput("https://web.de", 10, 5, 300, 20)
$btn = GUICtrlCreateButton("Ok", 40, 35, 240, 70)
ControlFocus($hWnd, "", $btn)
GUISetState()
While $msg <> -3
$msg = GUIGetMsg()
Select
Case $msg = $btn
Start()
Case $msg = -3
GUIDelete($hWnd)
Exit
EndSelect
WEnd
Func Start()
$URL = GUICtrlRead($input)
SplashTextOn("Screenshooting Web Site", "Please wait while taking screenshot", 300, 40, -1, -1, 1 + 2 + 4 + 32, "")
AdlibRegister("Wait", 300)
Web_Screenshot($URL)
AdlibUnRegister("Wait")
SplashOff()
MsgBox(0, "Information", "Web Site Image copied to clipboard!", 10)
EndFunc
Func Web_Screenshot($url, $IEwidth = 1045)
Local $oIE, $GUIActiveX, $oDocument, $oBody, $BodyWidth, $BodyHeight, $oHtml
Local $hGUI_WebGrab, $hWin, $aWin, $aMP
Local Const $BrowserNavConstant = 2 + 256 + 2048 ;BrowserNavConstant -> http://msdn.microsoft.com/en-us/library/dd565688(v=vs.85).aspx
$oIE = ObjCreate("Shell.Explorer.2") ;http://msdn.microsoft.com/en-us/library/aa752084(v=vs.85).aspx
$hWin = WinGetHandle("Program Manager")
$aWin = WinGetPos($hWin)
#region render web site to get height
$hGUI_WebGrab = GUICreate("", 0, 0, $aWin[0] - $BodyWidth + 1, $aWin[1] - $BodyHeight + 1, BitOR($WS_CLIPSIBLINGS, $WS_CLIPCHILDREN, $WS_POPUP),Default, WinGetHandle(AutoItWinGetTitle()))
;~ $hGUI_WebGrab = GUICreate("", 1024, 768, 0, 0, BitOR($WS_CLIPSIBLINGS, $WS_CLIPCHILDREN, $WS_POPUP),Default, WinGetHandle(AutoItWinGetTitle()))
$GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, $IEwidth, 256)
GUISetState(@SW_MINIMIZE, $hGUI_WebGrab)
;~ GUISetState(@SW_SHOW, $hGUI_WebGrab)
Local $timeout = 30 * 1000
Local $timer = TimerInit()
With $oIE
.Silent = True
.FullScreen = True
.Resizable = False
.Visible = False
.StatusBar = False
.AddressBar = False
.Navigate($URL, $BrowserNavConstant, "_top")
Do
If TimerDiff($timer) > $timeout Then ExitLoop
Sleep(100)
Until $oIE.ReadyState = 4
.Stop
Sleep(2000)
EndWith
$oDocument = $oIE.document
$oBody = $oDocument.body
$oBody.scroll = "no"
$oBody.style.borderStyle = "none"
$BodyWidth = Min($oBody.scrollWidth, 4096)
$BodyHeight = Min($oBody.scrollHeight, 8192)
GUIDelete($hGUI_WebGrab)
$GUIActiveX = 0
#endregion
Local $IE_Ver = RegRead("HKLM\SOFTWARE\Microsoft\Internet Explorer", "Version"), $height
If $IE_Ver > 8 Then $BodyHeight = Min($BodyHeight, 8192)
;~ ConsoleWrite($oIE.Path & @CRLF)
$hGUI_WebGrab = GUICreate("", $BodyWidth, $BodyHeight, $aWin[0] - $BodyWidth + 10, $aWin[1] - $BodyHeight + 10, BitOR($WS_CLIPSIBLINGS, $WS_CLIPCHILDREN, $WS_POPUP), Default, WinGetHandle(AutoItWinGetTitle()))
;~ $hGUI_WebGrab = GUICreate("", $BodyWidth, $BodyHeight, -1, -1, BitOR($WS_CLIPSIBLINGS, $WS_CLIPCHILDREN, $WS_POPUP), Default, WinGetHandle(AutoItWinGetTitle()))
$GUIActiveX = GUICtrlCreateObj ($oIE, 0, 0, $BodyWidth, $BodyHeight)
GUISetState(@SW_SHOW, $hGUI_WebGrab) ;Show GUI for some milli seconds to make a screenshot
$timer = TimerInit()
With $oIE
.Silent = True
.FullScreen = True
.Resizable = False
.Visible = False
.StatusBar = False
.AddressBar = False
.Navigate($URL, $BrowserNavConstant, "_top")
Do
If TimerDiff($timer) > $timeout Then ExitLoop
Sleep(100)
Until $oIE.ReadyState = 4
.Stop
Sleep(1000)
EndWith
$oDocument = $oIE.document
$oBody =$oDocument.body
$oHtml = $oDocument.documentElement
$oBody.scroll = "no"
$oBody.style.borderStyle = "none"
$oBody.style.border = "0px"
$oHtml.style.overflow = 'hidden'
Sleep(5000)
GUISetState(@SW_SHOW, $hGUI_WebGrab) ;Show GUI
Local $hDC = _WinAPI_GetWindowDC($hGUI_WebGrab)
Local $hDC_Dummy = _WinAPI_GetWindowDC(0)
Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC_Dummy)
Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC_Dummy, $BodyWidth, $BodyHeight)
_WinAPI_SelectObject($hMemDC, $hBitmap)
_WinAPI_BitBlt($hMemDC, 0, 0, $BodyWidth, $BodyHeight, $hDC, 0, 0, $SRCCOPY)
_WinAPI_DeleteDC($hMemDC)
_WinAPI_ReleaseDC($hGUI_WebGrab, $hDC)
_WinAPI_ReleaseDC(0, $hDC_Dummy)
_WinAPI_ReleaseDC(0, $hDC)
_ClipBoard_Open(0)
_ClipBoard_Empty()
_ClipBoard_SetDataEx($hBitmap, $CF_BITMAP)
_ClipBoard_Close()
_WinAPI_DeleteObject ($hBitmap)
$GUIActiveX = 0
$oIE = 0
GUIDelete($hGUI_WebGrab)
_ReduceMemory()
EndFunc
Func Min($a, $b)
If $a < $b Then Return $a
Return $b
EndFunc
Func Wait()
Switch Mod($i, 4)
Case 0
ControlSetText("Screenshooting Web Site", "", "Static1", "Please wait while taking screenshot")
Case 1
ControlSetText("Screenshooting Web Site", "", "Static1", "Please wait while taking screenshot .")
Case 2
ControlSetText("Screenshooting Web Site", "", "Static1", "Please wait while taking screenshot ..")
Case 3
ControlSetText("Screenshooting Web Site", "", "Static1", "Please wait while taking screenshot ...")
EndSwitch
$i += 1
EndFunc
Func _ReduceMemory($ProcID = 0)
If $ProcID = 0 or ProcessExists($ProcID) = 0 Then ; No process id specified or process doesn't exist - use current process instead.
Local $ai_GetCurrentProcess = DllCall('kernel32.dll', 'ptr', 'GetCurrentProcess')
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'ptr', $ai_GetCurrentProcess[0])
Return $ai_Return[0]
EndIf
Local $ai_Handle = DllCall("kernel32.dll", 'ptr', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $ProcID)
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'ptr', $ai_Handle[0])
DllCall('kernel32.dll', 'int', 'CloseHandle', 'ptr', $ai_Handle[0])
Return $ai_Return[0]
EndFunc
Alles anzeigen