Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

chrome as child

$
0
0

I ripped off a bit of code from here to sort of pseudo embedd an instance of google chrome in gui.

 

Thing is, it winds up all out of whack and not centered, wondering if anyone might know why?

AutoIt         
#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPIEx.au3> #include <Array.au3> #include <Constants.au3> #include <IE.au3> Dim $hGUI, $oIE, $sURL, $iLeft, $iTop, $iHeight, $iWidth $iLeft = 0 $iTop = 0 $iWidth = 1024 $iHeight = 768 Global $i_PID $hGUI = GUICreate("Test", $iWidth, $iHeight) ChromeCreatePseudoEmbedded($iLeft, $iTop, $iWidth, $iHeight, $hGUI) GUISetState(@SW_SHOW, $hGUI) While 1     $msg = GUIGetMsg()     If $msg = $GUI_EVENT_CLOSE Then         ;_IEQuit($oIE)         ProcessClose($i_PID)         Exit     EndIf WEnd Func ChromeCreatePseudoEmbedded($i_Left, $i_Top, $i_Width, $i_Height, $h_Parent, $f_ShowWin = False, $i_Timeout = 30000)     Local $i_PID, $o_IE, $h_HWND, $h_Timer = TimerInit()     $i_PID = Run(@ProgramFilesDir & "\Google\Chrome\Application\chrome.exe --chrome-frame -kiosk http://www.google.com")     If @error Then         MsgBox(0, 0, @error)         Exit     EndIf     $ah_HWND = _WinAPI_EnumProcessWindows($i_PID)     While Not IsArray($ah_HWND)         $ah_HWND = _WinAPI_EnumProcessWindows($i_PID)     WEnd     $h_HWND = HWnd($ah_HWND[1][0])     _WinAPI_SetParent($h_HWND, $h_Parent)     _WinAPI_MoveWindow($h_HWND, $i_Left, $i_Top, $i_Width, $i_Height, True)     _WinAPI_SetWindowLong($h_HWND, $GWL_STYLE, $WS_POPUP + $WS_VISIBLE)     If $f_ShowWin Then         WinSetState($h_HWND, "", @SW_SHOW)     EndIf EndFunc   ;==>ChromeCreatePseudoEmbedded

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>