Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP (and VBS) error in automation IE in Windows 10 only

Status
Not open for further replies.

JackTheC

Programmer
Feb 25, 2002
325
NL
I have a program that starts Internet Explorer and navigates to a certain website to do some stuff. (never mind what)
All worked well in XP, Vista, 7 and 8.
It also works well in most Windows 10 implementations. But not all. I have 7 times Win10 installed on testmachines and end-user systems.
2 of these 7 have a problem with automation of IE and I have no clue how to solve this and I don't know what is the important difference between the working and the troublesome computers.

Here is a piece of example code in VFP and VBS. Both have problems on these 2 computers:
Code:
myurl="[URL unfurl="true"]http://www.anysite.com/"[/URL]  && pick your own site

ieo=createobject("InternetExplorer.Application")
ieo.navigate(myurl)
do while ieo.readystate<>4
enddo   && sometimes here an error 0x80010108

windhand=ieo.hwnd && sometimes here an error 0x80010108

or in VBS

Code:
Set ieo = CreateObject("InternetExplorer.Application")
ieo.navigate "[URL unfurl="true"]http://www.anysite.com/"[/URL] 
ieo.Visible = True    '< error line 

Set objShell = CreateObject("WScript.Shell")
objShell.AppActivate ieo  '< or here

do while ieo.readystate<>4   '< or here  
loop

When the created object ieo is referenced to it produces error 0x80010108
The object invoked has disconnected from its clients

ieo seem to have vanished. hence the error.

The machines have IE version 11.0.10240.16431 (11.0.22) and I have 32/64 bit Computers. Just as I said most computers work well but one 32-bit and one 64-bit give the error above.

Can anyone reproduce the error on Windows 10? Has anyone a suggestion. I tried with and without Antivirus and the properties of IE are all the same as far as I can see. An implementation that works I can't get broke and an implementation that's broke I can't get to work.....

Technical Preview Win 10 with IE 11.0.10159 RTM also produces this error.
 
On the Tech.Preview I think I have solved it. Don't why. But I cleared all the browserdata. And now it works.

But on the other Computers, the VBS code seems to work after clearing the browserdata, but VFP still errors:
windhand=ieo.hwnd
the propertie hwnd is not recognized.
Edit, a Foxpro error: Function argument value, type, or count is invalid
Even ? ieo.hwnd returns the same error.


But in VBS
msgbox ieo.hwnd
hwnd is recognized and gives a proper hwnd value

 
The last thing that caused suh behaviour was protected mode. You had a reference to IE and jsut navigate casued a new tab to be started in a new protected thread or even separate process and so your reference got invalid.

Bye, Olaf.
 
Olaf, don't understand. Is it a setting in IE to correct this? On most computers the program or the examples run fine.
But on a couple computers VFP says about ieo.hwnd : Function argument value, type, or count is invalid

The option Protected Mode in IE security tab does not seem to have any influence on this error.
 
The option Protected Mode in IE security tab is what I talked about, but as said that was the last thing that caused such a behaviour, you might have a new reason.

Anyway, there is a little hope: You have to restart the computer (not only IE) to let the change have effect, so try it. Turn Protected Mode off and then restart.

Bye, Olaf.
 
Nope. Protected Mode with or without restart of computer had no effect on this error. Most Win10's work OK, some, with as far as I can see the same IE properties and settings, produce this error.

B.t.w. you can download Windows 10 from Microsofts site and install without activating at no cost (e.g. in a dual boot). After 1 month the implementation will auto shut off every couple of hours. Thats all.
 
Hi,

I suggest to insert a DOEVENTS into Your DO WHILE-loop:

do while ieo.readystate<>4
DOEVENTS
enddo

Without this DOEVENTS Your application is totally blocked by Your DO WHILE-loop !!!

Regards, Stefan
 
Stefan,

You are absolutely right. But I doubt that's the solution.

In my original program I have several lines in the do while-enddo loop, among an inkey(0.3), the old equivalent of Doevents.
I (accidently) left that line out when inserting the example above.

Nevertheless even without Doevents or inkey(0.3) it runs fine on the predecessors of Win10 and even most computers in Win10.
And even with inkey(0.3) it produces error on some Windows 10 machines. I'm still investigating, but I don't have access all the time to those PC's (other users elsewhere).

The VBS code runs fine now on all computers without a doevents-like interrupt.
But to be on the safe side I will insert a Wscript.Sleep(60) in the VBScript loop. Sleep() being the equivalent of Doevents since VBS doesn't have a Doevents command.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top