怎样用C#得知系统当前是否处于internet链结状态?请给出关键代码.当然最好是举一个简单例子.

解决方案 »

  1.   

    using System ;
    using System.Runtime ;
    using System.Runtime.InteropServices ; 
    public class InternetCS
    {//Creating the extern function...
    [DllImport("wininet.dll")]
    private extern static bool InternetGetConnectedState( out int Description, int ReservedValue ) ;//Creating a function that uses the API function...
    public static bool IsConnectedToInternet( )
    {int Desc ;
    return InternetGetConnectedState( out Desc, 0 ) ;}}
      

  2.   

    InternetGetConnectedState可以获得网络连接的状态
    不过要想非常精确的获得网线水晶头的插拔需要从底层网卡驱动获得
      

  3.   

    一试果真行!
    To:oyljerry
      "不过要想非常精确的获得网线水晶头的插拔需要从底层网卡驱动获得"
      不知是什么意思?