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


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

     public partial class UserControl1 : UserControl, IObjectSafety
        {
            //检测网络状态
            [DllImport("wininet.dll")]
            private extern static bool InternetGetConnectedState(out int connectionDescription, int reservedValue);
            /// <summary>
            /// 检测网络状态
            /// </summary>
            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.
                 }
    
         }
  • 相关阅读:
    less 28-31
    less27 27a
    sqli 26 26a
    sqli lab 25 25a
    kail 更新源
    sqli lab 23 、24
    less 20 21 22
    less18 19
    less 17
    数字类型,字符串类型,列表类型
  • 原文地址:https://www.cnblogs.com/lipanpan/p/3815692.html
Copyright © 2020-2023  润新知