Les Snippets

Connexion

Connexion internet existante

Niveau requis pour utiliser/comprendre cette source : 1 ( Débutant )
Créé le 30/03/2006 10:29:50 et initié par keikun59 [Liste]
Date de mise à jour : 31/03/2006 21:48:00
Vue : 7121
Catégorie(s) : API, Réseau & Internet
Langages dispo pour ce code :
- C# 1.x
- VB.NET 1.x
- VB6
- VB 2005



Langage : C# 1.x
Date ajout : 30/03/2006
Posté par keikun59 [Liste]
DateMAJ : 31/03/2006

[DllImport("wininet.dll")]

public extern static bool InternetGetConnectedState(out int Description, int ReservedValue);

public static bool IsConnected() 
{

        int Desc ;
        return InternetGetConnectedState(out Desc, 0);

}



Remarque :
Attention: Lire le commentaire de Brunews sur la fiabilité de InternetGetConnectedState.
http://www.vbfrance.com/codes/NET2-TESTER-CONNECTION-INTERNET-AUTRE-METHODE-HTTPWEBREQUEST_36008.aspx

Ajouter le "using System.Runtime.InteropServices;"
Pour plus d'information sur "InternetGetConnectedState" consulter http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/internetgetconnectedstate.asp
Langage : VB.NET 1.x
Date ajout : 31/03/2006
Posté par keikun59 [Liste]
DateMAJ : 31/03/2006

Private Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpdwFlags As Integer, ByVal dwReserved As Integer) As Boolean

Public Function IsConnected() As Boolean
    Dim Desc As Integer
    Return InternetGetConnectedState(Desc, 0) 
End Function

Remarque :
Attention: Lire le commentaire de Brunews sur la fiabilité de InternetGetConnectedState.
http://www.vbfrance.com/codes/NET2-TESTER-CONNECTION-INTERNET-AUTRE-METHODE-HTTPWEBREQUEST_36008.aspx

Ajouter le "Imports System.Runtime.InteropServices;"
Pour plus d'information sur "InternetGetConnectedState" consulter http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/internetgetconnectedstate.asp
Langage : VB6
Date ajout : 13/04/2006
Posté par PCPT [Liste]
Private Declare Function InetIsOffline Lib "url.dll" (ByVal dwFlags As LongAs Long 
'
Private Function IsConnected() As Boolean 
    On Local Error GoTo Err_Handler 
    IsConnected = Not CBool(InetIsOffline(0&)) 
    Exit Function 
Err_Handler: 
    IsConnected = False 
End Function
Langage : VB 2005
Date ajout : 01/06/2007
Posté par OneHacker [Liste]
my.Computer.Network.IsAvailable

Snippets en rapport avec : Internet, Connexion



Codes sources en rapport avec : Internet, Connexion

{Python} 'MES CONNEXIONS' OU COMMENT CONNAITRE LES CONNEXIONS ET LES EXE ACTIFS SUR VOTRE PC
'Mes connexions' est un petit soft codé en python créé par moi même avec l'aide de Lespinx qui perme...

{Visual Basic, VB6, VB.NET, VB 2005} CONNEXION D'ORDINATEURS ENTRE EUX (CLIENT SERVER) AVEC LES "WINSOCK"
je me permet de poster cette source qui n'est simplement que la réalisation pratique de ce que CELIP...

{Visual Basic, VB6, VB.NET, VB 2005} ETABLIR UNE CONNEXION INTERNET
Petite console qui permet de connecter/deconnecter l'ordinateur à internet. Inspiré par celui de Ma...

{Visual Basic, VB6, VB.NET, VB 2005} CONNEXION À UNE BASE DE DONNÉES MYSQL SUR INTERNET AVEC MYSQL CONNECTOR
Salut tout le monde, Alors je vous propose ma première source. J'ai tellement galérer pour trouve...

{Delphi} TESTE LA CONNEXION INTERNET ET DIT QUOI FAIRE
Si vous avez comme moi un papi ou une mamie qui ont toujours les mêmes problèmes pour se connecter s...

{Visual Basic, VB6, VB.NET, VB 2005} [.NET2] TESTER LA CONNECTION À INTERNET (AUTRE MÉTHODE PAR HTTPWEBREQUEST)
Bon d'accord il existe déjà ce genre de sources sur le site. Mais je viens proproper une "autre mét...

{Flash} TESTEUR DE CONNEXION INTERNET AVEC LOG MYSQL DES DÉCONNEXION
Voici une petite source qui ne comporte rien de très compliqué. Flash fait une tentative de connexio...

{JAVA / J2EE} TÉLÉCHARGEMENT D'IMAGES (POCHETTES CD, DVD, LIVRES...) SUR INTERNET
Petite fonction permettant de télécharger des images de cds, bd, livres, dvd, films, affiches par r...

{Delphi} IP INTERNET VIA UNE CONNEXION RÉSEAU - RÉCUPÉRER UNE IP DANS UN STRING
Petite programme simple permettant de connaître son IP Internet, même derrière une connexion réseau....

{C# / C#.NET} DISCONNECT INTERNET
Voici une petite application qui permet d'avoir des infos sur sa connection internet et qui de plus ...