This script AFireFox_Full.au3 shows how to embed full FireFox window into GUI:
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <FF.au3>
Global $sHKLM = "HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox"
Global $sFFExe = RegRead($sHKLM & "\" & RegRead($sHKLM, "CurrentVersion") & "\Main", "PathToExe")
;main window
Global $hWnd
;FF window
Global $hWndFF
;Zoom value
Global $ZoomValue = 1.1
;window dimensions
Global $WGui = 640
Global $HGui = 580
Global $XBr = 10
Global $YBr = 80
Global $WBr = 620
Global $HBr = 490
Global $DefaultFolder = @ScriptDir & "\"
Global $StartURL = "www.google.com"
$hWnd = GUICreate ( "AFireFox", $WGui, $HGui,10, 10, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPCHILDREN)
_GUISetIcon($hWnd, $sFFExe, -3)
; get sizes of client area
$Rect = WinGetClientSize($hwnd)
; Create Buttons
$GUI_Home = GuiCtrlCreateButton("Home", 10, 10, 50, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "Go to Home page")
$GUI_Back = GuiCtrlCreateButton("Back", 60, 10, 50, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "Go to previous page")
$GUI_Forward = GuiCtrlCreateButton("Forward", 110,10, 50, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "Go to next page")
$GUI_Stop = GuiCtrlCreateButton("Stop", 160, 10, 50, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "Stop laoding")
$GUI_ZoomP = GuiCtrlCreateButton("(+)", 210, 10, 25, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "Zoom in")
$GUI_ZoomM = GuiCtrlCreateButton("(-)", 235, 10, 25, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "Zoom out")
$GUI_Reset = GuiCtrlCreateButton("Reset", 260, 10, 50, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
$GUI_Restore = GuiCtrlCreateButton("Restore", 310, 10, 50, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
$GUI_Search = GuiCtrlCreateButton("Search", 360, 10, 50, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "Open Search dialog")
$GUI_Print = GuiCtrlCreateButton("Print", 410, 10, 50, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
$GUI_Config = GuiCtrlCreateButton("Config", 460, 10, 50, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "Open Configuration dialog")
$GUI_About = GuiCtrlCreateButton("About", 510, 10, 50, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "About FifeFox page")
; Create input control
$GUI_Input_Label = GuiCtrlCreateLabel("URL:", 30, 55, 30, 20)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
$GUI_Input = GuiCtrlCreateInput($StartURL, 65, 50, 295, 20)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
$GUI_Go = GuiCtrlCreateButton("Go", 365, 50, 50, 20)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "Go to URL")
$GUI_Browse = GuiCtrlCreateButton("Browse", 420, 50, 50, 20)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "Browse file")
;=======================================
; Thanks to:
; http://www.autoitscript.com/forum/index.php?showtopic=95151
$Dum = GUICtrlCreateDummy()
Dim $Accels[1][2] = [["{ENTER}", $Dum]]
GUISetAccelerators($Accels)
GUISetState()
$hWndFF = _FF_CreateEmbedded($hWnd, $XBr, $YBr, $WBr, $HBr)
_FFOpenURL("about:blank")
While True
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $GUI_Go or $msg = $Dum
$URL = GUICtrlRead($GUI_Input)
_FFOpenURL($URL)
$URL = _FFCmd(".location.href")
GUICtrlSetData($GUI_Input,$URL)
Case $msg = $GUI_About
_FFAction("About", "")
$URL = _FFCmd(".location.href")
GUICtrlSetData($GUI_Input,$URL)
Case $msg = $GUI_Config
_FFOpenURL("about:config")
$URL = _FFCmd(".location.href")
GUICtrlSetData($GUI_Input,$URL)
Case $msg = $GUI_Back
_FFAction("Back", "")
$URL = _FFCmd(".location.href")
GUICtrlSetData($GUI_Input,$URL)
Case $msg = $GUI_Forward
_FFAction("Forward", "")
$URL = _FFCmd(".location.href")
GUICtrlSetData($GUI_Input,$URL)
Case $msg = $GUI_Home
_FFAction("Home", "")
$URL = _FFCmd(".location.href")
GUICtrlSetData($GUI_Input,$URL)
Case $msg = $GUI_Stop
_FFAction("Stop", "")
$URL = _FFCmd(".location.href")
GUICtrlSetData($GUI_Input,$URL)
Case $msg = $GUI_ZoomP
$ZoomValue += 0.1
_FFAction("Zoom", $ZoomValue)
Case $msg = $GUI_ZoomM
If $ZoomValue > 0.5 then $ZoomValue -= 0.1
_FFAction("Zoom", $ZoomValue)
Case $msg = $GUI_Reset
_FFAction("Reset", "")
Case $msg = $GUI_Restore
TrickRestore()
Case $msg = $GUI_Search
_FFAction("Search", "")
WinActivate("[CLASS:MozillaDialogClass]","")
Case $msg = $GUI_Print
_FFAction("Print", "")
WinActivate("[CLASS:#32770]","")
Case $msg = $GUI_Browse
$URL = FileOpenDialog("Select any file to browse", @WorkingDir, "All files (*.*)", 1)
if not @error then
if StringInStr ($URL,'\') then $URL = _PathToURL($URL)
_FFOpenURL($URL)
$URL = _FFCmd(".location.href")
GUICtrlSetData($GUI_Input,$URL)
endif
EndSelect
$Rect_New = WinGetClientSize($hwnd)
if not @error and ($Rect_New[0] <> $Rect[0] or $Rect_New[1] <> $Rect[1]) then
$Rect = $Rect_New
WinMove($hWndFF, "", $XBr, $YBr, $rect[0] - 2*$XBr, $rect[1] - $YBr - $XBr)
endif
WEnd
;=============================
; take care!
; to escape error on close you should set
; pref option value "browser.tabs.warnOnClose" to false
$prefValue = "browser.tabs.warnOnClose"
_FFPrefSet($prefValue, "false")
;MsgBox(64, $prefValue, "Old value: " & @extended & @CrLf & "New value: " & _FFPrefGet($prefValue))
;and carefully close embedded FF window
WinClose($hWndFF)
_FFQuit()
GUIDelete()
exit
;===============================================================================
Func TrickRestore()
_FFOpenURL("about:blank")
_FFAction("Back", "")
EndFunc
;===============================================================================
Func _FF_CreateEmbedded($hGUI,$x, $y, $w, $h, $iTimeOut = 10000)
Local $OK
WinSetOnTop($hGUI,"",1)
Run($sFFExe & ' -P "default" -new-window "about:blank"', "", @SW_HIDE)
Local $iTimeOutTimer = TimerInit()
While 1
Sleep(500)
If ProcessExists($_FF_PROC_NAME) Then ExitLoop
If (TimerDiff($iTimeOutTimer) > $iTimeOut) Then
MsgBox(0,"Error", "Browser process not exists!")
Return ""
EndIf
WEnd
Do
_FFConnect()
$OK = @error
If @error Then _FFDisConnect()
Until Not $OK
_FFWindowSelect()
Local $hFF = _FFWindowGetHandle()
; This doesn't work correctly!
; GUISetStyle(BitOR($WS_POPUP, $WS_SIZEBOX), $WS_EX_MDICHILD, $hFF)
; This one works!
_FFStyle($hFF, BitOR($WS_POPUP, $WS_SIZEBOX),$WS_EX_MDICHILD)
WinMove($hFF, "", $x, $y, $w, $h)
; Do
; _FFAction("pm", True)
; Until Not @error
WinMove($hFF, "", $x, $y, $w, $h)
DllCall("user32.dll", "int", "SetParent", "hwnd", $hFF, "hwnd", $hGui)
WinSetOnTop($hGUI,"",0)
Return $hFF
EndFunc
;=================================================================================
; from
; http://www.autoitscript.com/forum/index.php?showtopic=96930
Func _GUISetIcon($hGui, $sModule, $iName)
GUISetIcon($sModule, $iName, $hGui)
Local $a_hCall = DllCall("user32.dll", "lresult", "SendMessageW", _
"hwnd", $hGui, _
"dword", 0x007F, _; WM_GETICON
"wparam", 0, _; 1 = ICON_BIG, 0 = ICON_SMALL
"lparam", 0)
DllCall("user32.dll", "lresult", "SendMessageW", _
"hwnd", $hGui, _
"dword", 0x0080, _; WM_SETICON
"wparam", 1, _; 1 = ICON_BIG, 0 = ICON_SMALL
"lparam", $a_hCall[0])
EndFunc
;=================================================================================
; create URL for any files
Func _PathToURL($Path)
$Parts = StringSplit(StringStripWS($Path,3),"\")
$Res = "file:///"
if StringRight($Parts[$Parts[0]],4) = ".chm" then $Res = "chm:file://"
for $i = 1 to $Parts[0]
$Text = StringSplit(BinaryToString(StringToBinary($Parts[$i],4),1),"")
For $j = 1 To $Text[0]
$nChar = Asc($Text[$j])
Switch $nChar
Case 45, 46, 48 to 58, 65 To 90, 95, 97 To 122, 126
$Res &= $Text[$j]
Case Else
$Res &= "%" & Hex($nChar,2)
EndSwitch
Next
if $i <> $Parts[0] then $Res &= "%5C"
next
return $Res
EndFunc
;===================================
;Set FF window style
func _FFStyle($hWnd, $Style=-1, $ExStyle=-1)
local $GWL_STYLE = -16, $GWL_EXSTYLE = -20
;if $Style = -1 then $Style = BitOR($WS_POPUP, $WS_SIZEBOX)
if $Style = -1 then $Style = BitOR($WS_CHILD, $WS_SIZEBOX)
$res = DllCall("User32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE, "int", $Style)
if $ExStyle <> -1 then $res = DllCall("User32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_EXSTYLE, "int", $ExStyle)
DllCall("user32.dll", "int", "SetWindowPos", "hwnd", $hWnd, "hwnd", 0, "int", 0, "int", 0, "int", 0, "int", 0, "int", 0x47)
endfunc
It doesn't use Presentation mode of FF. AFireFox_Full.au3 changes GUI style of FF by func _FFStyle, only.
to hide menu line (Alt key is to show it). You can hide also any panels and bars. After doing this installation the AFireFox_Full.au3 can be used like MS application hh.exe.