Jump to content

Recommended Posts

Right i hope i have this right now i just need little help on embeding ie 11 under a gui tab ie 11 opens embeds perfectly and you resize whatever just unable to get it to stay updaer tab 1

 

;IE11 code to embed
;Func _ProcessCloseEx($sPID) is better use over _iequit()

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <Constants.au3>
#include <IE.au3>


$STARTERPACK = GUICreate("TEST", 1261, 704, 189, 125)
$PageControl1 = GUICtrlCreateTab(0, 0, 1258, 700)
$TabSheet1 = GUICtrlCreateTabItem("TEST TAB 1")

;IE 11 TO GO HERE
$TabSheet2 = GUICtrlCreateTabItem("TEST TAB 2")
GUICtrlSetState(-1, $GUI_SHOW)
$Label5 = GUICtrlCreateLabel("HELLO MOM", 16, 145, 202, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUISetState(@SW_SHOW)

Local $pid, $hHandle, $hGUI, $sURL, $xHeight, $xWidth
$sURL = "about:blank"
$xWidth = 800
$xHeight = 600
$hGUI = GUICreate("Test", $xWidth, $xHeight)
$oIE = _IECreateEmbed2(500, 500, 10, 10, $hGUI)
_IENavigate($oIE, "www.google.com")

Func _IECreateEmbed2($xWidth, $xHeight, $iX, $iY, $hGUI)
    $pID = Run(@ProgramFilesDir & "\internet explorer\iexplore.exe -k " & $sURL, "", @SW_HIDE)
    Do
        Sleep(100)
    Until Not (ProcessExists($pID) = 0)
    $hHandle = _ProcessGetHWnd($pID)
    Do
        $oIElocal = _IEAttach($hHandle, "HWND")
        Sleep(100)
    Until $oIElocal <> 0
    GUISetState(@SW_SHOW, $hGUI)
    _WinAPI_SetParent($hHandle, $hGUI)
    _WinAPI_MoveWindow($hHandle, $iX, $iY, $xWidth, $xHeight, True)
    _WinAPI_SetWindowLong($hHandle, $GWL_STYLE, BitOR($WS_CHILD, $WS_VISIBLE))
    Return $oIElocal
EndFunc   ;==>_IECreate2

Func _ProcessGetHWnd($iPid, $sTitle = "", $iTimeout = 2000)
    Local $aWin
    While 1
        $aWin = WinList($sTitle)
        For $i = 1 To $aWin[0][0]
            If $iPid = WinGetProcess($aWin[$i][1]) Then
                Return $aWin[$i][1]
            EndIf
        Next
        Sleep(500) ; add a timer here
    WEnd
    SetError(1)
    Return 0
EndFunc   ;==>_ProcessGetHWnd

Do
    Sleep(50)
Until GUIGetMsg() = $GUI_EVENT_CLOSE
_ProcessCloseEx("iexplore.exe")

Func _ProcessCloseEx($sPID)
    If IsString($sPID) Then $sPID = ProcessExists($sPID)
    If Not $sPID Then Return SetError(1, 0, 0)

    Return Run(@ComSpec & " /c taskkill /F /PID " & $sPID & " /T", @SystemDir, @SW_HIDE)
EndFunc

 

Share this post


Link to post
Share on other sites

bikerbrooks,

As I said in our PM exchange, the Tabs tutorial in the Wiki explains how to manage non-native controls within a tab structure - you need to hide/show them yourself depending on the selected tab.

M23

 


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
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

×
×
  • Create New...