zoukankan      html  css  js  c++  java
  • 判断是否联网

       #region 是否联网
            private const int INTERNET_CONNECTION_MODEM = 1;
            private const int INTERNET_CONNECTION_LAN = 2;
            [DllImport("winInet.dll ")]
            private static extern bool InternetGetConnectedState(ref   int dwFlag, int dwReserved);
            private void NetConnect()
            {
                int dwFlag = new int();
                if (!InternetGetConnectedState(ref   dwFlag, 0))
                {
                    string locPath = AppDomain.CurrentDomain.BaseDirectory;
                    this.webView.Navigate(locPath + "html\videoLoc.html");
                    //未连网
                }
                else if ((dwFlag & INTERNET_CONNECTION_MODEM) != 0)
                {
                    string locPath = AppDomain.CurrentDomain.BaseDirectory;
                    this.webView.Navigate(locPath + "html\videoLoc.html");
                    //采用调治解调器上网
                }
                else if ((dwFlag & INTERNET_CONNECTION_LAN) != 0)
                {
                    string locPath = AppDomain.CurrentDomain.BaseDirectory;
                    this.webView.Navigate(locPath + "html\videoLoc.html");
                    //采用网卡上网
                }
                else
                {
                    string locPath = AppDomain.CurrentDomain.BaseDirectory;
                    this.webView.Navigate(locPath + "html\videoLoc.html");
                    //未连网
                }
            } 
            #endregion
  • 相关阅读:
    哈希及哈希算法
    十四章课后练习题
    第十章课后题----3
    20151015----知识整理
    第十章练习题----2
    加热水杯
    函数
    异常反馈
    20151013知识体系整理,需与20151011相整合
    Java随机输出验证码包含数字、字母、汉字
  • 原文地址:https://www.cnblogs.com/Iyce/p/4192855.html
Copyright © 2011-2022 走看看