Savoir si le pc est connecté à internet

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
Patix
Messages : 102
Inscription : ven. 19/nov./2004 14:17

Savoir si le pc est connecté à internet

Message par Patix »

Y a t'il une manip simple pour savoir si le pc est connecté à internet avec pure ?
:roll:
Avatar de l’utilisateur
Progi1984
Messages : 2659
Inscription : mar. 14/déc./2004 13:56
Localisation : France > Rennes
Contact :

Message par Progi1984 »

Test un ping sur www.google.fr !
Patix
Messages : 102
Inscription : ven. 19/nov./2004 14:17

Message par Patix »

Pourquoi pas :-) !

Merci

s'il y a d'autres soluces je suis preneur 8) .
comtois
Messages : 5186
Inscription : mer. 21/janv./2004 17:48
Contact :

Message par comtois »

je ne suis vraiment pas sûr , mais il me semble que cette question avait été posée sur le forum anglais , et regarde aussi dans codearchiv sur purearea.net
nico
Messages : 3702
Inscription : ven. 13/févr./2004 0:57

Message par nico »

Je viens de retrouver le lien, il y a un code que je copie ici:
http://jconserv.net/purebasic/viewtopic.php?t=10052

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) 
Patix
Messages : 102
Inscription : ven. 19/nov./2004 14:17

Message par Patix »

Merci je vais tester maintenant :-)
Répondre