【转】C#检测是否联网
2012-09-21 08:44
344 查看
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; namespace LocalApp.ConsoleApp.Core { public class Net { [DllImport("wininet")] private extern static bool InternetGetConnectedState(out int connectionDescription, int reservedValue); /// <summary> /// 检测本机是否联网 /// </summary> /// <returns></returns> public static bool IsConnectedInternet() { int i = 0; if (InternetGetConnectedState(out i, 0)) { //已联网 return true; } else { //未联网 return false; } } } }
相关文章推荐
- C#检测是否联网
- C#检测是否联网
- C#检测本机是否联网 调用系统函数
- C#检测是否联网
- C#检测是否联网
- C#检测本机是否联网
- c#检测端口是否被占用的简单实例
- C#检测是否有Sql危险字符
- 检测 邮箱地址 是否存在[C#]
- c#检测端口是否被占用的简单实例
- 【Silverlight5矢量打印】如何用C#代码检测打印机和驱动是否支持PostScript
- 判断是否联网_检测网络的类型为3G、2G、wap、wifi
- C# 窗口编辑后如何检测是否需要保存
- C# 判断 检测 access 建库 建表 文件是否存在等 数据操作 使用 ADOX
- C#检测转换是否成功
- 检测用户名是否存在(C#代码)
- C#检测上传图片是否安全函数
- C# ADO.net判断是否可以联网
- C#快速检测是否有可用的网络连接存在
- C#检测端口是否被占用(转帖)