January 1, 2005

WinTask - IsDestinationReachable

'
' IsDestinationReachable
'
' Author: Joe Strazzere
'

' "SENSAPI.DLL" Alias "IsDestinationReachableA"
' (ByVal lpszDestination As String,
'  ByRef lpQOCInfo As QOCINFO) As Long
'
dim ptr as unsigned
dim memptr as unsigned
dim memptr1 as unsigned
dim memptr2 as unsigned
dim memptr3 as unsigned
dim memptr4 as unsigned
ptr=allocate(128)
memptr=allocate(16)
PokeString(ptr, "http://www.wintask.com/", 1)
'Dest$="\JStrazzere"
a = External("SENSAPI","IsDestinationReachableA",ptr,memptr)
memptr1=memptr+0
memptr2=memptr+4
memptr3=memptr+8
memptr4=memptr+12
If a = 0 then
  Msgbox("No, "+Dest$+" is not reachable")
else
  sizein=peekinteger(memptr1,4)
  flags=peekinteger(memptr2,4)
  speedin=peekinteger(memptr3,4)
  speedout=peekinteger(memptr4,4)
  Msgbox("Yes, this destination is reachable.  Size="+str$(sizein)+" Flags="+str$(flags)+" Speed in="+str$(speedin)+" Speed out="+str$(speedout),,"IsDestinationReachable")
Endif