请问谁知道"本地连接"的"启用"/"禁用"是修改注册表的哪个项值的?

解决方案 »

  1.   

    需要先引用 Microsoft Shell Controls Automation(Shell32.dll)
      

  2.   

    试试这个//添加引用-COM-浏览-C:\WINDOWS\system32\shell32.dll-添加
    private bool SetNetworkAdapter(bool status)
    {
    const string discVerb = "禁用(&B)";
    const string connVerb = "启用(&A)";
    const string networkConnection = "网络连接";
    string sVerb;if (status) sVerb = connVerb;
    else sVerb = discVerb;Shell32.Shell sh = new Shell32.Shell();
    Shell32.Folder folder;folder = sh.NameSpace(3);   //Shell32.ShellSpecialFolderConstants.ssfCONTROLS
    try
    {
    foreach (Shell32.FolderItem myItem in folder.Items())
    {
    if (myItem.Name == networkConnection)
    {
    Shell32.Folder fd = (Shell32.Folder)myItem.GetFolder;
    foreach (Shell32.FolderItem fi in fd.Items())
    {
    if (fi.Name.IndexOf("VMware") > -1)
    {
    foreach (Shell32.FolderItemVerb Fib in fi.Verbs())
    {
    // listBox1.Items.Add(Fib.Name);
    if (Fib.Name == sVerb) 
    {
    Fib.DoIt();
    break;
    }
    }
    }
    }
    }
    }
    }
    catch (Exception e)
    {
    //sbpnl2.Text = e.Message;
    MessageBox.Show(e.Message);
    return false;
    }
    return true;
    }
      

  3.   

    我用“注册表 监视 软件”作为关键字在GOOGLE上搜索到了好几个,
    其中RegMon排名靠前,建议使用RegMon。