当前位置:编程学习 > C#/ASP.NET >>

求C#判断win8网络适配器是否禁用的代码

求C#判断win8网络适配器是否禁用的代码

 public static bool IsDisabled(string netWorkName)
        {
            string operation = "禁用";
            string operation2 = "停用";
            string oo = "启用";
            Shell32.Shell shell = new Shell32.ShellClass();
            Shell32.Folder folder = shell.NameSpace(49);
            foreach (Shell32.FolderItem fi in folder.Items())
            {
                if (fi.Name != netWorkName)
                {
                    continue;
                }
                Shell32.ShellFolderItem folderItem = (Shell32.ShellFolderItem)fi;
                foreach (Shell32.FolderItemVerb fiv in folderItem.Verbs())
                {
                    if (fiv.Name.Contains(oo))
                        return true;
                }
            }
            return false;
        }
这样的代码在win7可以,但是到了win8总是要么就总是禁用,要么就总是启用…… C# Windows 8 网络 shell
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,