using Microsoft.Win32;
//1.C#获取本地内网连接名
private void CreateList()
{
RegistryKey RegKey = Registry.LocalMachine;
RegKey= RegKey.OpenSubKey(@"SYSTEMControlSet001ControlNetwork{4D36E972-E325-11CE-BFC1-08002BE10318}");
string []KeysList = RegKey.GetSubKeyNames(); //Get List
foreach (string Key in KeysList)
{
//Except "useable" key--"Connection",it's other names "Descriptions";
if (Key == "Descriptions")
continue;
RegistryKey SubKey = RegKey.OpenSubKey(Key);
SubKey = SubKey.OpenSubKey("Connection");
comboBox1.Items.Add(SubKey.GetValue("Name"));
}
}
//2.C#获取本机拨号连接名
RegistryKey UserKey = Registry.CurrentUser;
RegistryKey Key = UserKey.OpenSubKey("RemoteAccess\Profile");
string[] KeysList = Key.GetSubKeyNames();
foreach (string key in KeysList)
{
comboBox1.Items.Add(key);
}