I am creating an OOB Silverlight application where I need to read the sub keys from the registry. Although I have tried writing the code, it is not working. How can I read the subkeys from registry in SL4. Below is the screenshot of the code.
if (AutomationFactory.IsAvailable)
{
using (dynamic locatorService = AutomationFactory.CreateObject("WbemScripting.SWbemLocator"))
{
const uint HKEY_CURRENT_USER = 0x80000001;
string strComputer = ".";
dynamic wmiService = locatorService.ConnectServer(strComputer, @"root\DEFAULT");
wmiService.Security_.ImpersonationLevel = 3;
dynamic reg = wmiService.Get("StdRegProv");
string strKeyPath = @"Software\Microsoft\Internet Explorer\TypedURLs";
string[] sValue = new string[] { };
uint result = reg.EnumKey(HKEY_CURRENT_USER, strKeyPath, out sValue);
foreach (var item in sValue)
{
MessageBox.Show(item);
}
}
}
User contributions licensed under CC BY-SA 3.0