Solved

Determine if Web Page is Open

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
firstswap challenge 20 77
C# Error - Add Failed 12 87
Auto-indent certain lines in Notepad++ 10 75
Removing line numbers from left column in config file 7 52
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

776 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