Knoxer
(Just in Town)
2016-06-30 06:21 PM
Creating an empty registry key

Hi,

I'm trying to do something seemingly easy, but it's proving quite difficult. I need to write out a registry key with no underlying values.

What I've tried so far:

 Code:
WriteValue("HKEY_CURRENT_USER\Software\Company\Title\Version\Security","","","REG_SZ")

Result:
Creates the empty key, but the Default value is not "Value Not Set" as it needs to be -- it has a blank value, which is different.

 Code:
WriteValue("HKEY_CURRENT_USER\Software\Company\Title\Version\Security","",,"REG_SZ")

Result:
Fails.

 Code:
WriteValue("HKEY_CURRENT_USER\Software\Company\Title\Version\Security")

Result:
Fails.

Is there a way to create just the "Security" key and keep the default value == (value not set)?

Thanks!


Glenn BarnasAdministrator
(KiX Supporter)
2016-06-30 06:30 PM
Re: Creating an empty registry key

Um, AddKey()?? This just adds a key to the registry.

Welcome to KORG!

Glenn


Knoxer
(Just in Town)
2016-06-30 06:38 PM
Re: Creating an empty registry key

Brilliant! I didn't even know that function existed. All my Google searches were pointing me towards WriteValue. Thank you so very much, Glenn.

Glenn BarnasAdministrator
(KiX Supporter)
2016-06-30 08:49 PM
Re: Creating an empty registry key

OK - I'll say it.. "RTFM!!" \:D

The friendly manual is available in several formats on the home page here, along with the online command reference. (after 21 years with Kix, I still hit the online reference regularly!) The command reference is pretty thorough, but doesn't deal with some of the variable and COM explanations that are covered in the manual, so it would be good to review that as well.

That function isn't too widely used compared to WriteValue, so not too surprising that Google fell short.

Glenn