Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fatal Error in InternetExplorer For Each Loop
Message
De
03/05/2001 11:17:38
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00502548
Message ID:
00503071
Vues:
24
>Hi!
>Try to use another loop than "FOR EACH ...". For example,
>
>FOR I=oIEobj.Document.Links.Count
> if type(oIEobj.Document.Links(I)) == "O"
> oLink = oIEobj.Document.Links(I)
> ....
> endif
>ENDFOR
>
>Another thing you can try is working using oIEobj.Object... reference, sometimes it is more reliable. Finally, VFP can crash when working with interfaces assigned to the variable. So try to do not assign oIEobj.Document.Links(I) to the variable, just do immediate work with it:
>
>REPLACE linktext WITH oIEobj.Document.Links(I).InnerText, ;
> linkurl WITH oIEobj.Document.Links(I).HREF
>
>HTH.
>
>>I am controlling an instance of InternetExplorer from inside VFP6. I have a simple program designed to get me a list of all the links on a designated web site. After navigating to the site and checking my readystates, I just have a simple section of code to get the list of links and save them to a database. The code looks like this:
>>
>>FOR EACH oLink IN oIEobj.Document.Links
>> REPLACE linktext WITH oLink.InnerText
>> REPLACE linkurl WITH oLink.HREF
>>ENDFOR
>>
>>On most web sites, it works fine, but on a few I get a FATAL EXCEPTION ERROR COOOO5, and the whole thing crashes out to the OS. On the web sites that crash the program, I can even rem out the two REPLACE lines and it still crashes (giving me the same error with the line number of the ENDFOR command). Has anyone experienced this and is there a fix?
>>
>>Thanks in advance
>>
>>John Dennis


Vlad,

Thanks a heap. I have been testing the TYPE of the variables and the problem is that even on the iteration where the routine crashes, the variable reports an "O" type object. It seems to be helpful to check if the variable is .NULL. All of your suggestions were very helpful. Working with the oIEobj.Object variable had not occurred to me, and is something I will look into. Thanks for everything.

John Dennis
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform