#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