Создать раздел реестра в VB.NET
Можем ли мы написать в раздел реестра
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATIONбез привилегий администратора в vb.net из приложения
Что я уже пробовал:
Dim app = Path.GetFileName(Application.ExecutablePath) Dim Regkey As RegistryKey = Nothing Dim lobjCurrentUserSPClientRegistryKey As Microsoft.Win32.RegistryKey If Environment.Is64BitProcess Then Regkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Wow6432Node\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION") 'For 32 bit machine Else Regkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION") End If Dim lobjCurrentUserRegistry As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine If Environment.Is64BitProcess Then lobjCurrentUserSPClientRegistryKey = lobjCurrentUserRegistry.OpenSubKey("SOFTWARE\\Wow6432Node\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION", RegistryKeyPermissionCheck.ReadWriteSubTree) 'Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Wow6432Node\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION", True) 'For 32 bit machine Else lobjCurrentUserSPClientRegistryKey = Regkey 'Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION", True) End If If (lobjCurrentUserSPClientRegistryKey IsNot Nothing) Then Dim lobjRegistryPreToolDocSubKey As Microsoft.Win32.RegistryKey = lobjCurrentUserSPClientRegistryKey.OpenSubKey(app, RegistryKeyPermissionCheck.ReadWriteSubTree) If (lobjRegistryPreToolDocSubKey Is Nothing) Then ' ' Create this "Previous Tool Documents" sub key. ' lobjRegistryPreToolDocSubKey = lobjCurrentUserSPClientRegistryKey.CreateSubKey(app, Microsoft.Win32.RegistryKeyPermissionCheck.ReadWriteSubTree) End If lobjRegistryPreToolDocSubKey.Dispose() lobjCurrentUserSPClientRegistryKey.Dispose() lobjCurrentUserRegistry.Dispose() SetRegistryValue("Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", app, "11001") End If
Richard MacCutchan
Нет, вы должны иметь права администратора, чтобы изменить этот ключ.
srinivas1221
спасибо Ричард