Sign in to follow this  
Followers 0
gil900

I managed to embed latest version of internet explorer in autoit GUI ! but i have few problems

6 posts in this topic

#1 ·  Posted (edited)

Hello,

I was looking for a way how to embed the latest IE version to GUI because I found that _IECreateEmbedded() can embed only IE 7 frame.

The reason why IE 7 is not good is because IE 7 does not display properly the website I want to display so i had to find a way to create frame of newer IE version..

 

I did a search for hours and i found that no one was gave good enough solution.

I found this thread:

'?do=embed' frameborder='0' data-embedContent>>

And one of the solutions I found in this thread is to change some key in the registry so the frame will be from another ie version and not from the default version(Which is ie 7)

The second solution that i thought about is to make code that do the following steps:

1) download the html file to temp folder

2) add to the html file <meta http-equiv="X-UA-Compatible" content="IE=9" >

3) load the html file with the standart normal IE functions.

I thought about this idea thanks to "chrshea" in post #5

I also tested the solution and it works. but not as as I expected. for some reason it froze the script to about - 20 seconds every time that _IENavigate() loaded the temp file file.

So i stopped developing this solution and kept looking for something else.

Another >solution I found is do not use IE at all and use some third-party add-ons - Which in this case is to use some ActiveX Control of some browser (like firefox or google chrome).

But this solution requires the user to install third-party browser that maybe he does not have, or requires me to embedding browser engine files in the exe..

I do not like it..

 

The next thing I looked for is a way to embed the GUI of iexplore.exe to my GUI - for example like embedding the Excel in autoit GUI.

I did a search how to do it and at the end I found myself here:
'?do=embed' frameborder='0' data-embedContent>>

I looked at the code and slowly researched how it works and after several attempts and also research about internet explorer, found out that in theory If i will solve few problams and adjust the code to work with internet explorer, then it must work.

And I was right. After a lot of trial and error and code adjustment, i I'm done with this result, which is still far from complete (which is why I need help)

The result:

1zx287.png

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPIEx.au3>
;~ #include <IE.au3>
#Include <Array.au3>


;~ While 1
;~  If ProcessExists("iexplore.exe") Then ProcessClose("iexplore.exe")
;~ WEnd

;~ $__IELoadWaitTimeout = 5000

Example("http://www.autoitscript.com/site/")



Func Example($Url)
    Local $Form1 , $Button1
    #region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("", 705, 671)
    $Button1 = GUICtrlCreateButton("Close", 600, 632, 89, 25)
    $aMain = IECreatePseudoEmbedded($Url, $Form1, 8, 16, 673, 609)
    If $aMain = -1 Then
        MsgBox(16,"Error","")
        Exit
    EndIf
;~  GUISetState(@SW_SHOW)
    #endregion ### END Koda GUI section ###
    WinSetOnTop($Form1, "", 1)
    Sleep(100)

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                WinClose($aMain[1])
                ProcessWaitClose($aMain[0])
                ExitLoop
            Case $Button1
                ExitLoop
        EndSwitch
    WEnd
    GUIDelete($Form1)
EndFunc


Func IECreatePseudoEmbedded($sURL, $h_Parent, $i_Left, $i_Top, $i_Width, $i_Height, $wait = 3000)
    Local $acMain[2]
    If Run(@ProgramFilesDir&"\Internet Explorer\iexplore.exe -k " & $sURL) = 0 Then Return -1
    If @error Then Return -1

    Local $timer
    $timer = TimerInit()
    Do
        If TimerDiff($timer) >= $wait Then Return -1
        $acMain[0] = WinGetProcess("[CLASS:IEFrame]")
        Sleep(10)
    Until $acMain[0] > 0


    $timer = TimerInit()
    While 1
        If TimerDiff($timer) >= $wait Then Return -1
        $list = WinList()
        For $a = 1 to $list[0][0]
            If StringRight($list[$a][0],20) = " - Internet Explorer" And WinGetProcess($list[$a][0]) = $acMain[0] Then
                $acMain[1] = $list[$a][1]
                ExitLoop 2
            EndIf
        Next
        Sleep(10)
    WEnd

    ;Sleep(300)
    _WinAPI_SetParent($acMain[1], $h_Parent)
    _WinAPI_SetWindowLong($acMain[1], $GWL_STYLE, $WS_POPUP + $WS_VISIBLE)

    ;Sleep(1000) ; <======= I must add that line. Otherwise result was
    ControlMove($acMain[1], "", "", $i_Left + 1, $i_Top + 1, $i_Width - 2, $i_Height - 2)
    GUISetState(@SW_SHOW, $h_Parent)
    WinActivate($acMain[1])
    Return $acMain
EndFunc
But this code still has some issues:
1) Sometimes the marked areas are missing as in the following example:
When this happens, the button close is block

2) Sometimes i get this result:
'>
 
This code is very unstable code.
I would love if someone will help me to improve it and make more stable code
 
 
Thanks for helpers!
 
Edit:
Oops.. i didn't saw this:
 
I thought no one did it before.. Too bad about the time I wasted just to find out I did not have to work too hard .
this is
 
 
It's a nice story..
zackrspv was the first who did it and made code that create  embedded ie frame -> then slbmeh learned from zackrspv and create code that make  embedded ie frame-> then JohnOne made code ​​based on the source code of the slbmeh that create create  embedded google chrome frame  -> then I created a code based on the source code of JohnOne that create  embedded ie frame

 

It is funny :)

 

 

 

 

 

Update:

I fixed all my problems! :P

look here:

'?do=embed' frameborder='0' data-embedContent>>

 

Update2:

This is the final example:

'?do=embed' frameborder='0' data-embedContent>>

Edited by gil900

Share this post


Link to post
Share on other sites



#4 ·  Posted (edited)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

hmm all the sites returned in that search displayed just fine in IE7 embedded.

I can see all the questions but I simply cannot find a site that does not display correctly in IE7.

Look for sites that work on HTML 5

This is my case.

Read also here:

http://www.wix.com/support/forum/html5/error-messages-and-known-bugs/other/internet-explorer-7-will-not-read-html

Please note that Wix is not comaptible with IE8 and lower, because those versions do not support HTML5 technology.

 

 
This should give you an answer
 
EDIT:
Edited by gil900

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
Sign in to follow this  
Followers 0