C# 判断计算机网络是否可用
2008-07-18 11:25
375 查看
using System.Runtime.InteropServices;
代码:
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState(out int connectionDescription, int reservedValue);
private static bool IsConnected()
{
int I = 0;
bool state = InternetGetConnectedState(out I, 0);
return state;
}
使用方法:
textBox1.Text = IsConnected().ToString();
代码:
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState(out int connectionDescription, int reservedValue);
private static bool IsConnected()
{
int I = 0;
bool state = InternetGetConnectedState(out I, 0);
return state;
}
使用方法:
textBox1.Text = IsConnected().ToString();
相关文章推荐
- C#判断当前计算机是否已经连接网络
- C#使用Ping功能判断网络连接状态或者目标计算机是否开机等
- c# 判断当前网络是否可用
- [C#]精确的判断网络是否可用
- android中判断网络是否可用
- Android检测网络状态,判断当前网络是否可用
- 判断数据网络是否可用
- C#判断网络是否通的代码
- 判断网络是否可用
- c# 判断网络是否中断
- C# 判断连接网络是否正常
- c# 判断网络是否连接
- Android中判断网络连接是否可用及监控网络状态
- Android判断网络是否可用
- C# 判断网络是否通的代码
- Broadcast监听网络状态,ping判断网络是否可用
- [华为机试练习题]54.判断任意两台计算机的IP地址是否属于同一子网络
- Android 开发之判断当前是否有网络可用
- Android手机判断网络是否可用