Use this undocumented method IsDestinationReachable located in sensapi.dll to check if your blog or a website in general is alive.
The debug window will display the connection path, the speed and True or False if the site destination is reachable.
Option Explicit
Private Type QOCINFO dwSize As Long dwFlags As Long dwInSpeed As Long dwOutSpeed As Long End Type
Public MonInterval As Long
Private Const NETWORK_ALIVE_LAN As Long = &H1 'active LAN cards Private Const NETWORK_ALIVE_WAN As Long = &H2 'active RAS connections Private Const NETWORK_ALIVE_AOL As Long = &H4 'connected to AOL (Win95/98 only) Private Declare Function IsDestinationReachable Lib "sensapi.dll" _ Alias "IsDestinationReachableA" (ByVal lpszDestination As String, _ lpQOCInfo As QOCINFO) As Long Public Function CheckSite(ByVal strHTTPSite As String) As Boolean Dim gRes As Long Dim structqoc As QOCINFO
structqoc.dwSize = Len(structqoc) gRes = IsDestinationReachable(strHTTPSite, structqoc)
With structqoc Select Case .dwFlags Case NETWORK_ALIVE_LAN: Debug.Print "LAN" Case NETWORK_ALIVE_WAN: Debug.Print "RAS" Case NETWORK_ALIVE_AOL: Debug.Print "AOL" Case Else: Debug.Print "Unknown" End Select
Debug.Print "IN:" & FormatNumber((.dwInSpeed / 1000), 0) & " kbps OUT:" & FormatNumber((.dwOutSpeed / 1000), 0) & " kbps" End With CheckSite = CBool(gRes) End Function
Visual Basic still rocks :)Labels: IsDestinationReachable, NETWORK_ALIVE_LAN, NETWORK_ALIVE_WAN |