using System.Runtime.InteropServices;
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState(out int Description, int ReservedValue);
public static bool IsConnectedToInternet()
{
int Desc;
return InternetGetConnectedState(out Desc, 0);
}
반환값이 True면 해당 컴퓨터는 인터넷 연결된 겁니다.
'C#' 카테고리의 다른 글
[C#]유휴시간 체크 예제 (0) | 2017.01.20 |
---|---|
[C#]Control.ForeColor에 HTML 색 표현하기 예제 (0) | 2017.01.12 |
[C#]CPU, Graphic, Memory 정보 얻기 예제 (0) | 2016.10.25 |
[C#]Winform Layout 깨지는 경우 해결 방법 (0) | 2016.10.24 |
[C#]화면 깜빡임 현상 제거 예제 (0) | 2016.10.24 |