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);
public static bool IsConnectedInternet()
{
int i = 0;
if (InternetGetConnectedState(out i, 0))
{
return true;//已联网
}
else
{
return false;//未联网
}
}
}
}
C#笔记(16)检查本机是否联网
最新推荐文章于 2024-06-18 10:23:01 发布