c# vs2010 winfrom控件检测网络环境

2020-12-13 03:42

阅读:275

标签:des   style   blog   color   art   cti   

写下以作备用,代码附上。

 public partial class UserControl1 : UserControl, IObjectSafety
    {
        //检测网络状态
        [DllImport("wininet.dll")]
        private extern static bool InternetGetConnectedState(out int connectionDescription, int reservedValue);
        /// 
        /// 检测网络状态
        /// 
        private bool isConnected()
        {
            int I = 0;
            bool state = InternetGetConnectedState(out I, 0);
            return state;
        }
     private void update_Load(object sender, EventArgs e)
        {
            if (isConnected())
            {
            //network  is connected.
            }
            else
            {
             //network is not connected.
             }

     }

 

c# vs2010 winfrom控件检测网络环境,搜素材,soscw.com

c# vs2010 winfrom控件检测网络环境

标签:des   style   blog   color   art   cti   

原文地址:http://www.cnblogs.com/lipanpan/p/3815692.html


评论


亲,登录后才可以留言!