Jump to content

[SOLVED] Embeded IE


Recommended Posts

Is it possible to remove the border around the activeX object?

#include <GUIConstantsEx.au3>
#include <windowsconstants.au3>
#include <winapi.au3>
#include <constants.au3>
#include <IE.au3> 


Global $Topx =70,$Topy = 30,$extMsg
Global $Plusx = 15, $Plusy = 70
Global $gui1 = GUICreate("Parent GUI", 773, 550, -1, -1, Default, $WS_EX_CONTROLPARENT)
GUISetBkColor(0x2c3b4a)

GUISetState()
;create layered window so we can have a transparent colour which will be applied to edit background as well as the window
Global $gui2 = GUICreate("child",684, 368,-1, -1, $WS_OVERLAPPED+$WS_POPUP, $WS_EX_LAYERED, $gui1)
$XT_oIE = _IECreateEmbedded()
$Obj_RCV = GUICtrlCreateObj($XT_oIE, 0, 0, 684, 368)
_IENavigate($XT_oIE, "about:blank")
$head = ""
DefineHead()
_IEDocWriteHTML($XT_oIE, "<HTML><HEAD>" & $head & "</HEAD><body bgcolor='Silver'></BODY></HTML>")
$oBody = _IETagNameGetCollection($XT_oIE, "body", 0)


_API_SetLayeredWindowAttributes($gui2,0xc0c0c0,255);set special colour fully transparent
GUISetState()
winsetontop($gui2,'',0)
GUIRegisterMsg($WM_MOVE,"Follow")
#endregion


#region - GUI SelectLoop
While 1
    $extMsg = GUIGetMsg(1)
    $msg = $extMsg[0]
    Switch $extMsg[1]
        Case $gui1
            Select
                Case $msg = $GUI_EVENT_CLOSE
                    Exit
            
            EndSelect
        
    EndSwitch
WEnd
#endregion


;===============================================================================
;
; Function Name:   _API_SetLayeredWindowAttributes
; Description:: Sets Layered Window Attributes:) See MSDN for more informaion
; Parameter(s):
;                 $hwnd - Handle of GUI to work on
;                 $i_transcolor - Transparent color
;                 $Transparency - Set Transparancy of GUI
;                 $isColorRef - If True, $i_transcolor is a COLORREF-Strucure, else an RGB-Color
; Requirement(s):  Layered Windows
; Return Value(s): Success: 1
;                 Error: 0
;                  @error: 1 to 3 - Error from DllCall
;                  @error: 4 - Function did not succeed - use
;                              _WinAPI_GetLastErrorMessage or _WinAPI_GetLastError to get more information
; Author(s):       Prog@ndy
;
;~;===============================================================================
Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)
    Local Const $AC_SRC_ALPHA = 1
    Local Const $ULW_ALPHA = 2
    Local Const $LWA_ALPHA = 0x2
    Local Const $LWA_COLORKEY = 0x1
    If Not $isColorRef Then
        $i_transcolor = Hex(String($i_transcolor), 6)
        $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
    EndIf
    Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA)
    Select
        Case @error
            Return SetError(@error, 0, 0)
        Case $Ret[0] = 0
            Return SetError(4, 0, 0)
        Case Else
            Return 1
    EndSelect
EndFunc;==>_API_SetLayeredWindowAttributes

Func Follow($hWnd)
    Local $wp = WinGetPos($gui1)
    If $hWnd = $gui1 then WinMove($gui2,"",$wp[0]+$Topy , $wp[1]+$Topx)
EndFunc

Func DefineHead()
    $head = '<script language="javascript">' & @CRLF
    $head = $head & "<!--" & @CRLF
    $head = $head & "       var state = 'none';" & @CRLF
    $head = $head & "function showhide(layer_ref) {" & @CRLF
    $head = $head & "if (state == 'block') {" & @CRLF
    $head = $head & "state = 'none';" & @CRLF
    $head = $head & "}" & @CRLF
    $head = $head & "else {" & @CRLF
    $head = $head & "state = 'block';" & @CRLF
    $head = $head & "}" & @CRLF
    $head = $head & "if (document.all) {" & @CRLF
    $head = $head & 'eval( " document.all." + layer_ref + " .style.display = state");' & @CRLF
    $head = $head & "}" & @CRLF
    $head = $head & "if (document.layers) {" & @CRLF
    $head = $head & "document.layers[layer_ref].display = state;" & @CRLF
    $head = $head & "}" & @CRLF
    $head = $head & "if (document.getElementById &&!document.all) {" & @CRLF
    $head = $head & "hza = document.getElementById(layer_ref);" & @CRLF
    $head = $head & "hza.style.display = state;" & @CRLF
    $head = $head & "}" & @CRLF
    $head = $head & "}" & @CRLF
    $head = $head & "//-->" & @CRLF
    $head = $head & "</script>" & @CRLF
EndFunc;==>DefineHead

Would like it to have no border. How can that be accomplished if the $obj_RECV handle (GuiCtrlCreateObj) doesn't allow extended styles....

Edited by zackrspv

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Sweet, didn't think it'd work that way, but that rocks :)

$head = $head & '<style type-" text / css">' & @CRLF
    $head = $head & "body{ " & @CRLF
    $head = $head & "border-width: 0px;" & @CRLF
    $head = $head & "border-style: solid;" & @CRLF
    $head = $head & "}" & @CRLF
    $head = $head & "</STYLE>" & @CRLF

Added that to my DefineHead() function :party: works wonders. Ty man :idea:

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

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...