Re: How To Know If an Internet Connection is Active

Author: Ken McGinnis

Posted: 2006-06-28 at 12:43:03

Here is some code I use: (I made some changes for obvious reasons and I have not checked this code)

lcURL = "http://www.yahoo.com"

Local ;

lodoc, ;

lcText, ;

loie, ;

llResult

llResult = .T.

Try

loie = Createobject("internetexplorer.Application")

Catch To oException

llResult = .F.

If Vartype(oException)='O' And ssidebug

With oException

ssiMessageBox ( ;

'Error '+Transform(.ErrorNo)+Chr(13)+ ;

' '+.Message+Chr(13)+ ;

' '+.LineContents+Chr(13)+ ;

' '+.Procedure )

Endwith

Endif

Endtry

If !llResult Or !Vartype(loie) = "O"

ssiMessagebox("There is a problem with your Internet connection"+Chr(13)+ ;

"If you are able to access the xxx main web site"+Chr(13)+ ;

"Please report this to xxx")

Return .F.

Endif

*loie.Visible = .T.

loie.Navigate(lcURL)

Inkey(.3) && need a small delay to setup the display.

Do While loie.Busy()

DoEvents

Inkey(.1)

Enddo

lodoc = loie.Document

lcText = lodoc.documentElement.innerText

************* now you can look in lcText to see if it has what you expect from that web site

----- Original Message -----

From: "G Gambill" <gwgambill@gmail.com>

To: <profox@leafe.com>

Sent: Wednesday, June 28, 2006 9:26 AM

Subject: How To Know If an Internet Connection is Active

How can I determine if an Internet Connection is active for PostCast Server.

I thought about

oIE = createobject( 'internetexplorer.application')

oIE.Navigate2( "http://www.yahoo.com" <http://www.yahoo.com/>)

but can't figure out how to programatically test if that was successful.

TIA

George

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

[excessive quoting removed by server]

©2006 Ken McGinnis