lod3n Posted September 15, 2006 Share Posted September 15, 2006 (edited) expandcollapse popup; I've since tried many variations, including creating "Shell.Explorer.2" objects on child GUIs. Same problem! ; ; What I'm doing here is creating two normal IE windows, modifying them to hide everything but the ; document window, attaching them to a parent AutoIt GUI as MDI children, and manually handling resize events. ; ; This is the worst workaround I've ever had to do. Thanks Microsoft! If you can think of a better ; way to crack this nut, do let me know. I'm not even close to happy with this, but this is the only ; thing I've tried that comes close to meeting the objective. If you have a need for this sort of thing, ; I think this is your best option. ; ; - lod3n, 9/15/2006 ; updated 7/7/09 to work with IE8 and AutoIt 3.3.0.0 #include <GUIConstants.au3> #include <windowsconstants.au3> #include <IE.au3> $realtitle = 'Dual "Embedded" IE Control Test' $waittitle = "Creating and harvesting the controls from Internet Explorer, please wait..." $gui = GUICreate($waittitle, 800, 600, -1, -1, BitOr($WS_SIZEBOX, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN)) ;set up two labels as reference points for resizing... $label1 = GUICtrlCreateLabel ("",0,0,800,300) GUICtrlSetBkColor ( -1,0xff0000) GUICtrlSetState ( -1,$GUI_DISABLE) GUICtrlSetState ( -1,$GUI_HIDE) $label2 = GUICtrlCreateLabel ("",0,300,800,300) GUICtrlSetBkColor ( -1,0x00ff00) GUICtrlSetBkColor ( -1,$GUI_DISABLE) GUICtrlSetState ( -1,$GUI_HIDE) GUISetState() ;set up the first IE window $oIE1 = _IECreate ("about:blank",0,1) ; creates an invisible instance of a regular browser window $oIE1.AddressBar = 0 ; turn off all four IE Bars - works on 3rd party bars too, mostly. $oIE1.MenuBar = 0 $oIE1.StatusBar = 0 $oIE1.ToolBar = 0 $uID1 = Random(1000, 100000000) ; give it a unique name so we can grab the correct handle and process ID $oIE1.document.title = $uID1 WinWait($uID1) $hoIE1 = WinGetHandle($uID1) $pid1 = WinGetProcess ($hoIE1) ;~ DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $hoIE1, "int", -16, "long",$WS_POPUP) DllCall("user32.dll", "int", "SetParent", "hwnd", $hoIE1, "hwnd", $gui) ; do it all over again for a second IE instance... $oIE2 = _IECreate ("about:blank",0,1) $oIE2.AddressBar = 0 $oIE2.MenuBar = 0 $oIE2.StatusBar = 0 $oIE2.ToolBar = 0 $uID2 = Random(1000, 100000000) $oIE2.document.title = $uID2 WinWait($uID2) $hoIE2 = WinGetHandle($uID2) $pid2 = WinGetProcess($hoIE2) ;~ DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $hoIE2, "int", -16, "long",$WS_POPUP) DllCall("user32.dll", "int", "SetParent", "hwnd", $hoIE2, "hwnd", $gui) ; find out where the labels are, and move the IE instances to the same locations repositionIEs() ; show the gui and the IE windows WinsetTitle($gui,"",$realtitle) WinActivate($gui) GUISetState() ;~ $oIE1.visible=1 ;~ $oIE2.visible=1 ; we've got object control of the instances thanks to _IECreate(), so... _IENavigate ($oIE1,"http://www.google.com") _IENavigate ($oIE2,"http://www.google.com") ; gui loop - you know the drill While 1 $msg = GUIGetMsg() Select case $msg = $GUI_EVENT_CLOSE exitloop case sizeEvent($msg) repositionIEs() EndSelect wend ; closing the gui does NOT implicitly close the IE instances, so I must close them manually. ; you'd think _IEQuit() would be the way to go, but not so much, no. GUIDelete($gui) While ProcessExists($pid1) ProcessClose($pid1) WEnd While ProcessExists($pid2) ProcessClose($pid2) WEnd func sizeEvent($event) ; there are four events I can hook that should trigger a resize if $event = $GUI_EVENT_MAXIMIZE or _ $event = $GUI_EVENT_MINIMIZE or _ $event = $GUI_EVENT_RESTORE or _ $event = $GUI_EVENT_RESIZED then return True Else return False EndIf EndFunc func repositionIEs() ; sadly, there is no GUICtrlGetPos, so I must use ControlGetPos. Poor, poor me. $pos1 = ControlGetPos($gui, "", "Static3") $pos2 = ControlGetPos($gui, "", "Static4") WinMove($hoIE1, "", $pos1[0], $pos1[1], $pos1[2], $pos1[3]) WinMove($hoIE2, "", $pos2[0], $pos2[1], $pos2[2], $pos2[3]) EndFunc Edited July 7, 2009 by lod3n [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
heibel Posted September 18, 2006 Share Posted September 18, 2006 Hi, Just thinking "loud"... What do you want to establish, besides using (the usual) frames... since: using frames you can control on whatever you want, interact between them etc.. You could even make a 3th-inbetween frame with only a "looks like two separated windows now"-picture/background... Just thinking "loud"... Harry Link to comment Share on other sites More sharing options...
lod3n Posted September 18, 2006 Author Share Posted September 18, 2006 Using a framed document is not a bad idea in many cases, but you can run in to trouble if someone has a Javascript in their head document that asks the browser to break out of frames. Like this:<head> <script> function breakout(){ if (top.location != location) { top.location.href = document.location.href; } } </script> </head> <body onload="breakout()"> <h1>Nah, nah, na-na-nah! You'll have to disable Javascript to load me as a frame!</h1></body></html>So if you have anything in one frame that you want to protect, well, don't use frames. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
JRSmile Posted July 6, 2009 Share Posted July 6, 2009 the example does not work on my pc,even after adding #include <windowsconstants.au3> no windows apear, could you please validate if the example still works? best regards, J. $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-) Link to comment Share on other sites More sharing options...
lod3n Posted July 7, 2009 Author Share Posted July 7, 2009 Yes, it looks like this example only works with IE6. Here's an example of embedding Calculator in an AutoIt GUI though: #include <GUIConstants.au3> #include <windowsconstants.au3> $realtitle = '"Embedded" Calc Test' $gui = GUICreate($realtitle, 800, 600, -1, -1, BitOr($WS_SIZEBOX, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN)) GUISetState() $pid = Run("Calc.exe") WinWait("Calculator") $hwnd = WinGetHandle("Calculator") DllCall("user32.dll", "int", "SetParent", "hwnd", $hwnd, "hwnd", $gui) While 1 $msg = GUIGetMsg() Select case $msg = $GUI_EVENT_CLOSE exitloop EndSelect wend ProcessClose($pid) [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
lod3n Posted July 7, 2009 Author Share Posted July 7, 2009 I've updated the example at the top to work with IE8 and AutoIt 3.3.0.0. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
Michel Claveau Posted July 8, 2009 Share Posted July 8, 2009 Hi! I suggest you change "about:blank" by "file: ///C:/myblank.htm" (without the space) Because "about:blank" send the IE instance in internet zone, and "file: ///..." send IE instance in local zone (and you have a better control/rights on the object). @-salutations -- Michel Claveau P.-S. don't forget to create your C:\myblank.htm ;-) Link to comment Share on other sites More sharing options...
JRSmile Posted July 8, 2009 Share Posted July 8, 2009 I've updated the example at the top to work with IE8 and AutoIt 3.3.0.0.nice example, is there a way to remove the borders of the child windows again as done in the old example? $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-) Link to comment Share on other sites More sharing options...
Will66 Posted July 9, 2009 Share Posted July 9, 2009 Not really sure what you need? but this is another way. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> _IEErrorHandlerRegister () Dim $oIE = _IECreateEmbedded () Dim $oIE2 = _IECreateEmbedded () Opt("GUIResizeMode", 1) Opt("GUIOnEventMode", 1) ; OnEvent mode Dim $gui = GUICreate("resizable", 800, 600,-1,-1,$WS_OVERLAPPEDWINDOW) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") Dim $GUIActiveX = GUICtrlCreateObj($oIE, 0, 0,800,250) _IENavigate ($oIE, "http://google.com") Dim $GUIActiveX2 = GUICtrlCreateObj($oIE2, 0, 300,800,250) _IENavigate ($oIE2, "http://images.google.com") GUISetState () While 1 Sleep(1000) ; Idle around WEnd Func CLOSEClicked() GUIDelete($gui) Exit EndFunc Link to comment Share on other sites More sharing options...
JRSmile Posted July 9, 2009 Share Posted July 9, 2009 not really, i need to remove the border of any application window you could imagine of, then set my gui as parrent and include the app into my gui, something like mremote for putty. http://www.mremote.org/wiki/ $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now