FreeTime - Stefano Passatordi 's Blog


Libera la mente...ecco il Blog di Stefano Passatordi
Statistiche
  • Views Home Page: 161.549
  • Views Posts: 380.788
  • Views Gallerie: 794.632
  • n° Posts: 210
  • n° Commenti: 148
Archivio Posts
Anno 2010

Anno 2009

Anno 2008

Anno 2007

Anno 2006

Anno 2005
Mappa

Testare lo stato della connessione

Ecco come testare lo stato della connessione :

C# :

using System.Runtime.InteropServices ;
public class ConnectionState
  {
    [DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState(out int Description, int ReservedValue);

public ConnectionState()
{

}

    public static bool ConnessioneInternet( )//rileva se la macchina è on-line    {
   {
    
int Desc ;
    
return InternetGetConnectedState( out Desc, 0 ) ;
   
}
  }

VB.Net :

Imports System.Runtime.InteropServices

Public Class ConnectionState

 <DllImport("wininet.dll")> _
 Private Shared Function InternetGetConnectedState(ByRef Description As Integer, ByVal ReservedValue As Integer) As Boolean
End Function

Public Sub New()
End Sub

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

End Class

Categoria: Programmazione
giovedì, 09 mar 2006 Ore. 00.03
Ora e Data
Calendario
aprile 2025
lmmgvsd
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011
Blogs Amici
    Links
      Copyright © 2002-2007 - Blogs 2.0
      dotNetHell.it | Home Page Blogs
      ASP.NET 2.0 Windows 2003