My apologies for the delayed response, but after much testing I've been able to embed an IE window into my form & set up basic browsing controls. The program will store up to 20 URLs before it starts removing the first entry when a new URL is added. The code is a bit lengthy but I wanted to share it with the community in case someone else may have a similar need.
Thank you again Dale for the most excellent assist. If I may ask, how do I edit the title of this topic to include the [SOLVED] prefix?
#include <ButtonConstants.au3>
#Include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WinAPI.au3>
#Include <WindowsConstants.au3>
Local $Form1, $Border1, $Border2, $Label1, $Input1
Local $Button1, $Button2, $Button3
Local $arrURLs, $strURLs = "", $Counter = 1, $Switch = 0, $objIE, $objIEdoc
_EmbedIE
()
Func _EmbedIE
()
$Form1 = GUICreate("Test", 1000, 750, 200, 50, BitOR($WS_CAPTION, $WS_SYSMENU, $WS_CLIPCHILDREN))
$Border1 = GUICtrlCreateLabel("", 0, 30, 1000, 720, $SS_SUNKEN)
$Button1 = GUICtrlCreateButton("Back", 5, 5, 55, 20)
$Button2 = GUICtrlCreateButton("Forward", 65, 5, 55, 20)
$Button3 = GUICtrlCreateButton("GO", 665, 5, 30, 20)
GUICtrlSetState($Button1, $GUI_DISABLE)
GUICtrlSetState($Button2, $GUI_DISABLE)
$Label1 = GUICtrlCreateLabel("URL", 125, 5, 26, 20, BitOR($SS_CENTER, $SS_CENTERIMAGE))
$Input1 = GUICtrlCreateInput("", 155, 5, 500, 20)
$processID = Run(@ProgramFilesDir & "\internet explorer\iexplore.exe -k" , "", @SW_HIDE)
ProcessWait($processID)
Sleep(500)
$objIE = _GetIEObject
($processID)
ObjEvent($objIE, "_IEEvent_", "DWebBrowserEvents2")
$objIE.Navigate("about:blank")
Do
$objIEdoc = $objIE.Document
Until IsObj($objIEdoc)
ObjEvent($objIEdoc, "_IEDocEvent_")
$hwndIE = HWnd($objIE.HWND)
_WinAPI_SetParent($hwndIE, $Form1)
_WinAPI_MoveWindow($hwndIE, 1, 31, 998, 718, True)
_WinAPI_SetWindowLong($hwndIE, $GWL_STYLE, BitOR($WS_CHILD, $WS_VISIBLE))
GUISetState(@SW_SHOW)
EndFunc
Func _PageCounter
()
If $Switch < 1 Or $Switch > 2 Then
$arrURLs = StringSplit($strURLs, ",")
If $arrURLs[0] > 20 Then
$strURLs = StringMid($strURLs, StringInStr($strURLs, ",") + 1)
$arrURLs = StringSplit($strURLs, ",")
EndIf
If $Counter < 20 And $Switch > 2 Then
$Counter += 1
EndIf
EndIf
Switch $Switch
Case 1
If $Counter < 2 Then
GUICtrlSetState($Button1, $GUI_DISABLE)
EndIf
GUICtrlSetState($Button2, $GUI_ENABLE)
Case 2
If $Counter >= $arrURLs[0] Then
GUICtrlSetState($Button2, $GUI_DISABLE)
EndIf
GUICtrlSetState($Button1, $GUI_ENABLE)
Case 3 To 4
If $Counter > 1 Then
GUICtrlSetState($Button1, $GUI_ENABLE)
EndIf
GUICtrlSetState($Button2, $GUI_DISABLE)
EndSwitch
EndFunc
Func _GetIEObject
($pid)
$objShell = ObjCreate("Shell.Application")
$objShellWindows = $objShell.Windows
If $objShellWindows.Count > 0 Then
For $objShellWindow In $objShellWindows
If WinGetProcess(HWnd($objShellWindow.HWND)) = $pid Then
Return $objShellWindow
EndIf
Next
EndIf
EndFunc
Func _PostNavigation
()
While $objIE.Busy
Sleep(100)
WEnd
GUICtrlSetData($Input1, $objIE.LocationURL)
EndFunc
Func _IEDocEvent
_OnClick
()
$Switch = 4
EndFunc
Func _IEEvent
_BeforeNavigate2
($IEobj, $IEurl, $Flags, $TargetFrameName, $PostData, $Headers, $Cancel)
If $IEobj = $objIE Then
GUICtrlSetData($Input1, $IEurl)
EndIf
EndFunc
Func _IEEvent
_NavigateComplete2
($IEobj, $IEurl)
If $IEobj = $objIE Then
If $Switch = 0 Then
$a = StringInStr($strURLs, ",", 0, -1)
$strURLs = StringMid($strURLs, 1, $a) & $IEurl
_PageCounter
()
Else
If $strURLs = "" Then
$strURLs = $IEurl
_PageCounter
()
Else
If StringInStr($strURLs, $IEurl) = 0 Then
$strURLs &= "," & $IEurl
_PageCounter
()
ElseIf $arrURLs[$arrURLs[0]] <> $IEurl Then
For $a = 1 to $Counter - 1
Select
Case $a = 1
$strURLs = $arrURLs[$a]
Case Else
$strURLs &= "," & $arrURLs[$a]
EndSelect
Next
$strURLs &= "," & $IEurl
_PageCounter
()
EndIf
EndIf
$Switch = 0
EndIf
_PostNavigation
()
EndIf
EndFunc
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUISetState(@SW_HIDE)
$objIE.Quit
Sleep(500)
Exit
Case $Button1
$Switch = 1
$Counter -= 1
_PageCounter
()
$objIE.Navigate($arrURLs[$Counter])
Case $Button2
$Switch = 2
$Counter += 1
_PageCounter
()
$objIE.Navigate($arrURLs[$Counter])
Case $Button3
$URL = GUICtrlRead($Input1)
If $URL = "" Then
$URL = "about:blank"
EndIf
$Switch = 3
$objIE.Navigate($URL)
Case $Input1
ControlClick($Form1, "", $Button3)
EndSwitch
WEnd