I'm trying to manually create keys under HKEY_CLASSES_ROOT\CLSID. If the key does not start with {, I can create the key successfully. If I attempt to create a key with a starting left bracket, IE "{68FAB877-EAF8-3196-9360-1AADDCDABE1B}", no error is returned but the key isn't created either.
regKey.CreateSubKey(CheckRegKey(vNewSubKey)).Close()
If I use the same code and pass in ".{68FAB877-EAF8-3196-9360-1AADDCDABE1B}", the key is created. I can then go into regedit and manually rename the key taking out the period and everything is peachy. Given that I can create any other key, I'm confident that the createsubkey line is valid.
How can I create the key correctly through code so that it includes the left bracket?
André:
After reading your post, I did some testing. I broke out my code that is used above to this:
MsgBox("creating Key")
RegKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Classes\CLSID\", True)
RegKey.CreateSubKey("{00000000-EAF8-3196-9360-1AADDCDABE1B}")
RegKey.Close()
I tested the above code on my box (WinXP x64) and it doesn't create the necessary key.
I tested the code on a WinXP (32 bit box) and it works fine.
I tested on another box that is Win7, x86 and it was fine.
Tried on another box that is Win7 x64 and it doesn't work again. So it appears the issue is with writing the key on x64 boxes. Any ideas?