public static class Internet
{
[DllImport("winInet.dll")]
private static extern bool InternetGetConnectedState(ref int dwFlag, int dwReserved); /// <summary>
/// 返回网络状态
/// </summary>
public static bool Status
{
get
{
Int32 dwFlag = new int();
if (!InternetGetConnectedState(ref dwFlag, 0))
{
return false;
}
else
{
return true;
}
}
}
}