Solved

Determine if Web Page is Open

Posted on 2013-05-13
1
450 Views
Last Modified: 2013-05-13
I have a foxpro form button that when clicks goes out and opens a web page

loIE = CREATEOBJECT("InternetExplorer.Application")
loIE.NAVIGATE(alltrim(webpage))
loIE.VISIBLE=.T.
Then I ask if they want to download the page

I want to be able to tell if the user closed the page before I issue the loIE.quit command.
what is the command?
0
Comment
Question by:timjshields
1 Comment
 
LVL 41

Accepted Solution

by:
pcelba earned 425 total points
ID: 39161983
loIE = CREATEOBJECT("InternetExplorer.Application")
loIE.NAVIGATE(alltrim(webpage))
loIE.VISIBLE=.T.
will download the page from the internet so why are you asking if they want to download?

And what do you mean by "user closed the page"? Does it mean close the IE tab with the downloaded page? Or does it mean user closed the IE application?

OK, I'll try to answer...

If you issue
loIE = CREATEOBJECT("InternetExplorer.Application")
loIE.NAVIGATE2(alltrim(webpage))

DO WHILE VARTYPE(loIE) = 'O' AND loIE.busy
  WAIT WINDOW "IE busy" TIME 0.2
  DOEVENTS
ENDDO

DO WHILE VARTYPE(loIE) = 'O' AND loIE.document.readyState#"complete"
  WAIT WINDOW "Waiting for document" TIME 0.2
  DOEVENTS
ENDDO

loIE.VISIBLE=.T.

You may send the IE window to top of all other windows by calling appropriate Win32API with loIE.HWND as a parameter.

To test if user closed the page you may issue
IF TYPE("loIE.HWND") = "N"
  *-- Page is still open
ELSE
  *-- User closed the page
  loIE.QUIT   &&  THIS DOES NOT WORK NOW !!!
ENDIF
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Specific format 21 140
firstChar challenge 13 83
drawing animated level bar based on numbers 3 72
Excel To Access Database Transfer 14 42
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Viewers will learn the different options available in the Backstage view in Excel 2013.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now