Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Determine if Web Page is Open

Posted on 2013-05-13
1
453 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 42

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
split53 challenge 7 109
Word 2010 - Review Pane setting is not persisting 4 23
Programming Codes 2 21
what is the best Integrated development environment 2 20
A short article about a problem I had getting the GPS LocationListener working.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

856 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