Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Determine if Web Page is Open

Posted on 2013-05-13
1
Medium Priority
?
459 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 43

Accepted Solution

by:
pcelba earned 1700 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Make the most of your online learning experience.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Loops Section Overview

824 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