From page 85 of the component reference doc.
Why is the variable reg created? I only see sec being used in the following 2 functions.
Also… When calling this function, what does “return invalid” return? I need to if block the return value…
Finally… When calling SetAuthData() will this example take into account a null registry section or one already populated with data. If null I want to create and save data, if not null I want to overwrite value.
THX…
Function GetAuthData() As Dynamic
reg = CreateObject("roRegistry")
sec = CreateObject("roRegistrySection", "Authentication")
if sec.Exists("UserRegistrationToken")
return sec.Read("UserRegistrationToken")
endif
return invalid
End Function
Function SetAuthData(userToken As String) As Void
reg = CreateObject("roRegistry")
sec = CreateObject("roRegistrySection", "Authentication")
sec.Write("UserRegistrationToken ", userToken)
sec.Flush()
End Function
OK Thanks for your reply.
Kevin, Patrick will you enlighten us on the use of reg in your documentation example?
THX
EngoTom,
You are correct that the roRegistry object is not necessary to read/write from the registry sections. It’s methods are only useful to iterate and manage the different sections of the registry.
Its inclusion in the examples is historical as it used to be the only way to Flush() the registry… but now Flush() can be called on roRegistrySection directly.
–Kevin
As it’s currently implemented, RegistrySection.Flush just calls Registry.Flush, which flushes the whole registry. I wouldn’t preclude the possibility that someday RegistrySection.Flush might be changed to only flush that one section, but I don’t know of any plans to change it.
–Mark
Thank you RokuMarkn, your answer - concise as always - is appreciated!
Yeah, i can imagine how registry could be partitioned - yet the 16kb limit will render performance benefits negligible.