Jump to content

Read out screen (IE) from memory


UEZ
 Share

Recommended Posts

Is it possible to get the screen from memory which will be created by embedded IE?

From the help file:

; *******************************************************
; Example 1 - Trap COM errors so that 'Back' and 'Forward'
;               outside of history bounds does not abort script
;               (expect COM errors to be sent to the console)
; *******************************************************
;
#include <Array.au3>
#include <Clipboard.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
AutoItSetOption("WinTitleMatchMode", 4)

_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()
$hGUI = GUICreate("Embedded Web control Test", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360)
$GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)
$GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)
$GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
$GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)

GUISetState()       ;Show GUI

_IENavigate ($oIE, "http://www.autoitscript.com")
Sleep(500)

#region only a test section
$oDocument = $oIE.document
$oBody = $oIE.document.body
$oHtml = $oIE.document.documentElement

;~ $oBody.scroll = "no"
;~ $oBody.style.borderStyle = "none"
;~ $oHtml.style.overflow = 'hidden'
;~ $oBody.style.overflow = 'hidden'
$BodyWidth = $oBody.scrollWidth
$BodyHeight = $oBody.scrollHeight
$RootWidth = $oHtml.scrollWidth
$RootHeight = $oHtml.scrollHeight

$oIE_handle = ControlGetHandle($hGUI, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]")

$hDC = _WinAPI_GetDC($oIE_handle)
$hMemDC = _WinAPI_CreateCompatibleDC($hDC)
$hBmp = _WinAPI_CreateCompatibleBitmap($hDC, $BodyWidth, $RootHeight)
_WinAPI_SelectObject($hMemDc, $hBmp)
_WinAPI_BitBlt($hMemDC, 0, 0, $BodyWidth, $RootHeight, $hDC , 0, 0, $SRCCOPY)

_ClipBoard_Open(0)
_ClipBoard_Empty()
_ClipBoard_SetDataEx($hBmp, $CF_BITMAP)
_ClipBoard_Close()
_WinAPI_DeleteDC($hMemDC)
_WinAPI_ReleaseDC(0, $hDC)
_WinAPI_DeleteObject ($hBmp)
#endregion

; Waiting for user to close the window
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $GUI_Button_Home
            _IENavigate ($oIE, "http://www.autoitscript.com")
        Case $msg = $GUI_Button_Back
            _IEAction ($oIE, "back")
        Case $msg = $GUI_Button_Forward
            _IEAction ($oIE, "forward")
        Case $msg = $GUI_Button_Stop
            _IEAction ($oIE, "stop")
    EndSelect
WEnd

GUIDelete()

Exit

As you can see the web site will be rendered within the GUI.

Is it possible to copy the screen from embedded IE to a bitmap by reading it off the memory?

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...