请问谁知道"本地连接"的"启用"/"禁用"是修改注册表的哪个项值的?
解决方案 »
- 求c#做GPRS的程序学习
- C#中如何用函数捕获输入设备超时(C/S架构),因为要做一个小型系统的“暂时离开”窗口,就是电脑一定时间不动就会自动锁定系统。
- 请高手看看,这段程序有什么错误,为什么调用不出来?
- 初学泛型,一个问题请教!
- 救命啊!!!菜鸟请教问题
- 如何用C#自动获得CPU、内存、网络流量的数据啊
- 请问大侠们:如何判断一个控件是不是在设计期状态呀?
- 关于sessionState的问题,十万火急!!!(高分)
- 编译问题
- 如何在crystal中插入子報表的子報表
- .net remoting中的BinaryFormatter Version incompatibility问题!!!
- 还是取文本
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;
}
其中RegMon排名靠前,建议使用RegMon。