Solved

Determine if Web Page is Open

Posted on 2013-05-13
1
456 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
[X]
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
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

Database Solutions Engineer FAQs

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller single-server environments.

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

623 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