求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#