Для работы вам понадобится подключить следующие пространства имен:
using Microsoft.Win32; using System.Collections; using System.Collections.Generic;Функция:
public static ListGetAllRegisteredFileExtensions() { //get into the HKEY_CLASSES_ROOT RegistryKey root = Registry.ClassesRoot; //generic list to hold all the subkey names List subKeys = new List (); //IEnumerator for enumerating through the subkeys IEnumerator enums = root.GetSubKeyNames().GetEnumerator(); //make sure we still have values while (enums.MoveNext()) { //all registered extensions start with a period (.) so //we need to check for that if (enums.Current.ToString().StartsWith(".")) //valid extension so add it subKeys.Add(enums.Current.ToString()); } return subKeys; }



Комментариев нет:
Отправить комментарий
Большая просьба, не писать в комментариях всякую ерунду не по теме!