Private Const FLAG_ICC_FORCE_CONNECTION = &H1
Private Declare Function InternetCheckConnection Lib "wininet.dll" _
Alias "InternetCheckConnectionA" _
(ByVal lpszUrl As String, _
ByVal dwFlags As Long, _
ByVal dwReserved As Long) _
As Long
Private Sub Form_Load()
' Med timern kontrollerar vi var ~30 sekund
' intervall om domänen finns eller inte
Timer1.Interval = 30000
End Sub
Public Function CheckSite(ByVal strURL As String) As Boolean
' returnerar sant om sajten finns, annars falskt
CheckSite = (InternetCheckConnection(strURL, _
FLAG_ICC_FORCE_CONNECTION, _
0&) _
<> 0)
End Function
Private Sub Timer1_Timer()
' kontrollera denna domänen
If CheckSite("http://www.pellesoft.nu/") Then
MsgBox "fungerar"
Else
MsgBox "fungerar inte"
End If
End Sub