I'm Creating new Keys in the registry, but when I do, they always have
a Vaule called (Default) type RG_SZ. I need them to be DWord
dword:00000005
Is there a way to automaticaly make the (Default) a Dword using the
CreateSubKey method?
If not, How can I use the SetValue Method t change the Default from
RG_SZ to DWord?
WHY:?
Setting Cookies to always block for a list of sites (3500+)
The key is
[HKEY_CURRENT_USER\Software\Microsoft\Windows\Curre ntVersion\Internet
Settings\P3P\History\doubleclick.com]
@=dword:00000005
The only value in these keys is default, and it's a Dword. I can get it all
to work if I use VBS & a .txt file. As VBS allows me to create the subkey
(doubleclick.com) and it's value in one line of code.
Surely if VBS can do this C# can?
**Attempted Code**
private string sSubKey =
@"Software\Microsoft\Windows\CurrentVersion\Intern et Settings\P3P\History\";
public void AddBlockCookies()
{
foreach(string x in strBlkCookiesLst)
{
RegistryKey Key = Registry.CurrentUser;
using (Key.CreateSubKey(sSubKey + x
+@"\"))Key.SetValue(null,Convert.ToInt32(00000005) );
Key.Close;
}
}
Also tried
using (Key.OpenSubKey(sSubKey + x
+@"\"))Key.SetValue(null,Convert.ToInt32(00000005) );
But since I have to create the key first to get this to work the default
value is already created, that's why I went to the first idea.