Alaska Software Inc. - Internet Explorer - Automation 6500 errors
Username: Password:
AuthorTopic: Internet Explorer - Automation 6500 errors
Chris Carmac Internet Explorer - Automation 6500 errors
on Wed, 07 Mar 2012 12:26:23 -0500
Does anyone know what causes Automation 6500 errors when using Internet 
Explorer objects?
		
In my code I create a HTML file containing some Base64 encoded data. 
The file contains some XML data formatted according to the 
specifications given to me by the web site that I'm trying to access.  I 
create an Internet Explorer object in code and then navigate to the site 
using the file I created.  No problem there.  I then wait in
a loop until the web site creates and populates an element named 
ICTransactionComplete. Once the element exists and has data in it, I end 
my loop, retrieve the data from the element, and continue processing.

Most of time, the code works fine.  However, occasionally I will get 
weird errors that seem to indicate the IE object has become corrupted 
and/or lost connection to the web site.  I have included a sample of my 
code below.  Below my code I have included some examples of the errors 
I'm getting.

Is there a better/safer/easier way to do this?  Any ideas regarding how 
I can prevent these types of errors?

Any help will be greatly appreciated! Thanks! 

Chris Carmac
		
		
LOCAL oIE, xVal, oDocument, oError, bOldError
LOCAL lDone     := .F.
LOCAL cFile	    := ''
LOCAL bOldError := ERRORBLOCK()

oIE := CreateObject("InternetExplorer.Application") 		
oIE:RegisterAsBrowser := .T.		
cFile := CreateRequestFile()
oIE:navigate("file://"+cFile)	 	
oIE:Visible := .T.  	

 Wait here while page loads
DO WHILE oIE:Busy	
ENDDO

oDocument := oIE:document	

 Force submit
oDocument:ICI_POST:submit()		

 So far, so good -the web page loads as expected

DO WHILE !lDone

    Wait here while page loads
   DO WHILE oIE:Busy	
   ENDDO			
	
    Crash point 1
   xVal := oDocument:getElementsByName('ICITransactionComplete')
	
    End the loop if the element exists and is not empty
   IF !EMPTY(xVal)
       Crash point 2
      lDone := xVal:length > 0
   ENDIF
	
ENDDO

RECOVER USING oError

   IF oError:osCode == -2147023174 .OR. oError:osCode == -2147417848
      .OR. oError:osCode == -2147467259
       Do nothing - these errors are thrown when then user
       manually closes the IE window without posting a return value
   ELSE
     EVAL(bOldError,oError)// Exit program with error message
   ENDIF	
	
END SEQUENCE

 Continue processing...

		
oError:args         :
     -> VALTYPE: C VALUE: length
oError:canDefault   : Y
oError:canRetry     : N
oError:canSubstitute: Y
oError:cargo        : NIL
oError:description  : Access is denied.

oError:filename     : NIL
oError:genCode      : NIL
oError:operation    : length
oError:osCode       :          -2147024891
oError:severity     :          2
oError:subCode      :       6500
oError:subSystem    : Automation
oError:thread       :          1
oError:tries        : NIL


oError:args         :
     -> VALTYPE: C VALUE: getElementsByName
     -> VALTYPE: C VALUE: ICITransactionComplete
oError:canDefault   : Y
oError:canRetry     : N
oError:canSubstitute: Y
oError:cargo        : NIL
oError:description  : The remote procedure call failed.

oError:filename     : NIL
oError:genCode      : NIL
oError:operation    : getElementsByName
oError:osCode       :          -2147023170
oError:severity     :          2
oError:subCode      :       6500
oError:subSystem    : Automation
oError:thread       :          1
oError:tries        : NIL


oError:args         :
     -> VALTYPE: C VALUE: Busy
oError:canDefault   : Y
oError:canRetry     : N
oError:canSubstitute: Y
oError:cargo        : NIL
oError:description  : The remote procedure call failed.

oError:filename     : NIL
oError:genCode      : NIL
oError:operation    : Busy
oError:osCode       :          -2147023170
oError:severity     :          2
oError:subCode      :       6500
oError:subSystem    : Automation
oError:thread       :          1
oError:tries        : NIL


oError:args         :
           -> VALTYPE: C VALUE: getElementsByName
           -> VALTYPE: C VALUE: ICITransactionComplete
oError:canDefault   : Y
oError:canRetry     : N
oError:canSubstitute: Y
oError:cargo        : NIL
oError:descript
AUGE_ OHRRe: Internet Explorer - Automation 6500 errors
on Thu, 08 Mar 2012 02:57:07 +0100
hi,

> Does anyone know what causes Automation 6500 errors when using Internet 
> Explorer objects?
> ...
> oIE := CreateObject("InternetExplorer.Application")

wrong Way, use XbpHTMLViewer()

btw. CreateObject() in Xbase++ meen "one way to" a Automation Object.
you will not "get" Events and you cannt o:subscribeEvent() to get Notify 
"from" activeX.

greetings by OHR
Jimmy
Chris Carmac Re: Internet Explorer - Automation 6500 errors
on Thu, 08 Mar 2012 16:05:43 -0500
Jimmy,

Thanks for the suggestion!  I'll check out XbpHTMViewer().

I appreciate the help! 

Chris


On 3/7/2012 8:57 PM, AUGE_ OHR wrote:
> hi,
>
>> Does anyone know what causes Automation 6500 errors when using Internet
>> Explorer objects?
>> ...
>> oIE := CreateObject("InternetExplorer.Application")
>
> wrong Way, use XbpHTMLViewer()
>
> btw. CreateObject() in Xbase++ meen "one way to" a Automation Object.
> you will not "get" Events and you cann´t o:subscribeEvent() to get Notify
> "from" activeX.
>
> greetings by OHR
> Jimmy
>
>
>
JUAN GONZALEZRe: Internet Explorer - Automation 6500 errors
on Sat, 03 Nov 2012 21:18:19 +0100
Hi Chris.
I had the same problem. I changed the way to check if internet explorer 
object was "busy" with a timer. I mean, I watch IE not being busy for at 
least 2 seconds, not just with:
>   DO WHILE oIE:Busy	
>   ENDDO			
the way i did at first time.
6500 errors dissapeared to me, but I'm just testing.
And in every loop like that, I put "Sleep(50)" before ENDDO because of the 
usage of cpu.

FUNCTION IE_Busy(oIE)
LOCAL lRta:=.T.
LOCAL nSegInicio:=SECONDS(),nCronometro
DO WHILE .T.
  nCronometro=SECONDS()+IIF(SECONDS()<nSegInicio,86400,0)
  IF oIE:readyState<>4
    lRta=.T.
    EXIT
  ELSE
    IF nCronometro-nSegInicio>=2 //2 seconds with readystate=4
      lRta=.F.
      EXIT
    ENDIF
  ENDIF
ENDDO
RETU lRta

I hope this helps you.
Juan





Chris Carmac <ccarmac@freedomsoft.info> wrote in message news:1c3aa478
$30a68c06$3a3c8@news.alaska-software.com...
>Does anyone know what causes Automation 6500 errors when using Internet 
>Explorer objects?
>		
>In my code I create a HTML file containing some Base64 encoded data. 
>The file contains some XML data formatted according to the 
>specifications given to me by the web site that I'm trying to access.  I 
>create an Internet Explorer object in code and then navigate to the site 
>using the file I created.  No problem there.  I then wait in
>a loop until the web site creates and populates an element named 
>ICTransactionComplete. Once the element exists and has data in it, I end 
>my loop, retrieve the data from the element, and continue processing.
>
>Most of time, the code works fine.  However, occasionally I will get 
>weird errors that seem to indicate the IE object has become corrupted 
>and/or lost connection to the web site.  I have included a sample of my 
>code below.  Below my code I have included some examples of the errors 
>I'm getting.
>
>Is there a better/safer/easier way to do this?  Any ideas regarding how 
>I can prevent these types of errors?
>
>Any help will be greatly appreciated! Thanks! 
>
>Chris Carmac
>		
>		
>LOCAL oIE, xVal, oDocument, oError, bOldError
>LOCAL lDone     := .F.
>LOCAL cFile	    := ''
>LOCAL bOldError := ERRORBLOCK()
>
>oIE := CreateObject("InternetExplorer.Application") 		
>oIE:RegisterAsBrowser := .T.		
>cFile := CreateRequestFile()
>oIE:navigate("file://"+cFile)	 	
>oIE:Visible := .T.  	
>
>// Wait here while page loads
>DO WHILE oIE:Busy	
>ENDDO
>
>oDocument := oIE:document	
>
>// Force submit
>oDocument:ICI_POST:submit()		
>
>// So far, so good -the web page loads as expected
>
>DO WHILE !lDone
>
>    Wait here while page loads
>   DO WHILE oIE:Busy	
>   ENDDO			
>	
>    Crash point 1
>   xVal := oDocument:getElementsByName('ICITransactionComplete')
>	
>    End the loop if the element exists and is not empty
>   IF !EMPTY(xVal)
>       Crash point 2
>      lDone := xVal:length > 0
>   ENDIF
>	
>ENDDO
>
>RECOVER USING oError
>
>   IF oError:osCode == -2147023174 .OR. oError:osCode == -2147417848
>      .OR. oError:osCode == -2147467259
>       Do nothing - these errors are thrown when then user
>       manually closes the IE window without posting a return value
>   ELSE
>     EVAL(bOldError,oError)// Exit program with error message
>   ENDIF	
>	
>END SEQUENCE
>
>// Continue processing...
>
>		
>oError:args         :
>     -> VALTYPE: C VALUE: length
>oError:canDefault   : Y
>oError:canRetry     : N
>oError:canSubstitute: Y
>oError:cargo        : NIL
>oError:description  : Access is denied.
>
>oError:filename     : NIL
>oError:genCode      : NIL
>oError:operation    : length
>oError:osCode       :          -2147024891
>oError:severity     :          2
>oError:subCode      :       6500
>oError:subSystem    : Automation
>oError:thread       :          1
>oError:tries        : NIL
>
>
>oError:args         :
>     -> VALTYPE: C VALUE: getElementsByName
>     -> VALTYPE: C VALUE: ICITransactionComplete
>oError:canDefault   : Y
>oError:canRetry     : N
>oError:canSubstitute: Y
>oError:cargo        : NIL
>oError:description  : The remote procedure call failed.
>
>oError:filename     : NIL
>oError:genCode      : NIL
>oError:operation    : getElementsByName
>oError:osCode       :          -2147023170
>oError:severity     :          2
>oError:subCode      :       6500
>oError:subSystem    : Automation
>oError:thread       :          1
>oError:tries        : NIL
>
>
>oError:args         :
>     -> VALTYPE: C VALUE: Busy
>oError:canDefault   : Y
>oError:canRetry     : N
>oError:canSubstitute: Y
>oError:cargo        : NIL
>oError:description  : The remote procedure call failed.
>
>oError:filename     : NIL
>oError:genCode      : NIL
>oError:operation    : Busy
>oError:osCode       :          -2147023170
>oError:severity     :          2
>oError:subCode      :       6500
>oError:subSystem    : Automation
>oError:thread       :          1
>oError:tries        : NIL
>
>
>oError:args         :
>           -> VALTYPE: C VALUE: getElementsByName
>           -> VALTYPE: C VALUE: ICITransactionComplete
>oError:canDefault   : Y
>oError:canRetry     : N
>oError:canSubstitute: Y
>oError:cargo        : NIL
>oError:descript