10-31-2011، 02:53 PM
ابتدا NameSpace هاي زير را وارد مي كنيم
سپس تابع زير را استفاده مي كنيم
کد:
using System.Collections.Generic;
using Microsoft.Win32;
کد:
public List<string> PopulateUrlList()
{
//list the main registry key to open
String regKey = "Software\\Microsoft\\Internet Explorer\\TypedURLs";
RegistryKey subKey = Registry.CurrentUser.OpenSubKey(regKey);
String url;
//create a list to hold our URL's
List<string> urlList = new List<string>();
int counter = 1;
while (true)
{
//grab the current value, in the registry the key name
//is url1, url2, url3, etc, while the value is the
//actual url
String sValName = "url" + counter.ToString();
url = (String)subKey.GetValue(sValName);
if ((object)url == null)
break;
urlList.Add(url);
counter++;
}
return urlList;
}