用C#检测你的网络连接(转载)

using System ;
using
System.Runtime ;
using System.Runtime.InteropServices ;

public class InternetCS
{

//Creating the extern function...
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState( int out Description, int ReservedValue ) ;

//Creating a function that uses the API function...
public static bool IsConnectedToInternet( )
{

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

}

}

转自:http://blog.csdn.net/rcom10002/archive/2005/01/11/249267.aspx

原文地址:https://www.cnblogs.com/johnwonder/p/1676768.html