DICHIARAZIONI DA INSERIRE IN UN MODULO:
Public Declare Function InternetGetConnectedState Lib "wininet" ecc.
Public Const CONNECT_LAN
Public Const CONNECT_MODEM
Public Const CONNECT_PROXY
Public Const CONNECT_OFFLINE
Public Const CONNECT_CONFIGURED
'anche questi con i rispettivi valori..
Public Function IsConnected(Optional Byref sconntype as string)as Boolean
dim dwflags as Long
dim webtest as boolean
sconntype = " "
bconnected = Internetgetconnectedstate(dwflags,0&)
Select case bconnected
case dwflags and connect_lan
sconntype = "LAN"
case dwflags and connect_modem
sconntype = "MODEM"
case dwflags and connect_proxy
sconntype = "PROXY"
case dwflags and connect_offline
sconntype = "OFFLINE"
case dwflags and connect_configured
sconntype = "CONFIGURED"
case else
sconntype = "Remote"
end select
isconnected = bconnected
end function
SE VUOI CONTROLLARE OGNI TOT DI TEMPO INSERISCI IL CODICE SOTTOSTANTE NELL'EVENTO TIMER
dim smsg as string
dim sconntype as string
if isconnected(sconntype) then
smsg = "Sei connesso ad Internet tramite " & sconntype & "."
else
smsg = "Non sei connesso ad Internet"
end if
Msgbox smsg,vbOkOnly,"Stato della Connessione Internet"
end sub
============================
Dovrebbe funzionare tranquillamente, altrimenti scrivi di nuovo..(non ho preso il codice da vb ma l'ho scritto senza uso del programma quindi ci potrebbero essere errori di scrittura di alcune variabili, ti prego di controllare tanto il listato non è lungo..ciao