class Internet
    {
        //Creating the extern function...
        [DllImport("wininet.dll")]
        private extern static bool InternetGetConnectedState( out int Description, 
                  int ReservedValue ) ;

        /// <summary>
        /// 인터넷 연결 체크
        /// </summary>
        /// <returns>인터넷 연결이 안된 경우 false</returns>
        public static bool IsConnectedToInternet( )
        {
            int Desc ;
            return InternetGetConnectedState( out Desc, 0 ) ;
        }
    }

'프로그래밍 > C#' 카테고리의 다른 글

[C#] 관리자 권한으로 실행 설정  (1) 2012.04.02
[C#] Percent Encoding  (0) 2012.03.28
[C#] Convert String to System.Windows.Forms.Shortcut  (0) 2012.03.23
Posted by 암리타 :