Tuesday, September 20, 2011

internet explorer bypass for ready state

Hello again!

The event technique to see if internet explorer was ready did not work out at all
The event check were taking lots of cpu (on my i7!!!)

So i simply made a do loop with a try inside, to try every 1/10th of a second to access internet explorer (write in frame) for 1 sec. That was enough to remove any crash in windows xp

Futur: i'll need to manage every writing in internet explorer or any interacting with it, with the same do loop and try.

So here is the code, before i write in internet explorer, i put all my html in htmtab.


        try01 = 0
        err01 = 0
        Do
            Try
                ffra = oIE.Document.frames.item("f" & ffranam.ToString).document
                System.Threading.Thread.Sleep(100)
            Catch ex As Exception
                If logall = 1 Then fil02.WriteLine(DateValue(Now) & " " & TimeValue(Now) & " crash creating frame again " & ex.Message)
                err01 = err01 + 1
            End Try
            If err01 = 0 Then Exit Do
        Loop Until err01 > 10
        If err01 > 10 Then
            If logall = 1 Then fil02.WriteLine(DateValue(Now) & " " & TimeValue(Now) & " error trying to recreate frame: " & err01)
            End
        End If

No comments:

Post a Comment