日期:2011-08-04 浏览次数:20432 次
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;
}
static void Main(string[] args)
{
Console.WriteLine(IsConnected().ToString());
}