• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 262
  • Last Modified:

Continue after an error

I have the following code in vb6 to check the current version of my software before it opens.

cData = Inet1.OpenURL("http://www.mywebsite.org/version.txt", 0)

The problem is that sometimes www.mywebsite.org is sometimes down and I don't want the program to get hung up on trying to locate an unreachable file.

When I recieve an error on the above site, what can I do to make the program continue
0
al4629740
Asked:
al4629740
  • 3
  • 2
2 Solutions
 
Peter KwanCommented:
on error resume next
0
 
vb_elmarCommented:
You can constantly check the State of the Inet1 control using a timer.
Here is a small code sample.
2.zip
0
 
al4629740Author Commented:
How about this?

If InternetCheckConnection("http://www.mywebsite.org/", &H1, 0) = 1 Then

'Code goes here

end if
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
al4629740Author Commented:
i would declare

Private Declare Function InternetCheckConnection Lib "wininet.dll" Alias _
"InternetCheckConnectionA" (ByVal lpszUrl As String, ByVal dwFlags As Long, _
ByVal dwReserved As Long) As Long
0
 
vb_elmarCommented:
InternetCheckConnection allows to check if a connection to
"http://www.mywebsite.org/" can be established.

It is not capable to check if the file "version.txt" on the web page "http://www.mywebsite.org/" exists.
0
 
vb_elmarCommented:
To check if "www.mywebsite.org" is down and the file "version.txt" is reachable or unreachable
I recommend the "URLDownloadToFile" API. -See the attached code sample.
5.zip
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now