al4629740
asked on
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
Private Declare Function InternetCheckConnection Lib "wininet.dll" Alias _
"InternetCheckConnectionA"
ByVal dwReserved As Long) As Long
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.
"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.
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
I recommend the "URLDownloadToFile" API. -See the attached code sample.
5.zip
ASKER
If InternetCheckConnection("http://www.mywebsite.org/"
'Code goes here
end if