Savoir si le pc est connecté à internet
Publié : ven. 04/févr./2005 21:19
Y a t'il une manip simple pour savoir si le pc est connecté à internet avec pure ?


Forums PureBasic - Français
http://forums.purebasic.com/french/
Code : Tout sélectionner
; HowIsInternet - 09/22/2003 updated by TerryHough
; (c) ses007, 2003
; From PB forum, topic
; http://jconserv.net/purebasic/viewtopic.php?t=5590
#INTERNET_CONNECTION_MODEM = $1
#INTERNET_CONNECTION_LAN = $2
#INTERNET_CONNECTION_PROXY = $4
#INTERNET_CONNECTION_MODEM_BUSY = $8
#INTERNET_CONNECTION_OFFLINE = $20
#INTERNET_CONNECTION_CONFIGURED = $40
#INTERNET_RAS_INSTALLED = $10
Procedure.s InternetStatus()
Protected dwflags.l, msg.s
If InternetGetConnectedState_(@dwflags, 0)
If dwflags & #INTERNET_CONNECTION_CONFIGURED
msg = msg + "An Internet connection is configured." + Chr(10)
EndIf
If dwflags & #INTERNET_RAS_INSTALLED
msg = msg + "A Remote Access Service (RAS) is installed." + Chr(10)
EndIf
If dwflags & #INTERNET_CONNECTION_MODEM
msg = msg + "The Internet connection is made by a modem"
EndIf
If dwflags & #INTERNET_CONNECTION_LAN
msg = msg + "The Internet connection is made via a network (LAN)"
EndIf
If dwflags & #INTERNET_CONNECTION_PROXY
msg = msg + " and using a Proxy server." + Chr(10)
Else
msg = msg + "." + Chr(10)
EndIf
If dwflags & #INTERNET_CONNECTION_OFFLINE
msg = msg + "The Internet connection is currently offline. "
Else
msg = msg + "The Internet connection is currently connected (online)." + Chr(10)
EndIf
If dwflags & #INTERNET_CONNECTION_MODEM_BUSY
msg = msg + "The modem is busy with another connection."
EndIf
Else
msg = "Currently, there is no Internet connection."
EndIf
ProcedureReturn msg
EndProcedure
MessageRequester("Internet Connection", InternetStatus(), #MB_ICONINFORMATION)