Reads a value from the registry returning a default value if not found.

Syntax

Result = SRP_Registry("READDEF", Key, ValueName, Value, Error)

Returns

The registry value if found, or the supplied default value if there was an error.

Value

The value parameter contains the default value to be returned in the event of an error or if the value doesn't exist.

Errors

This service never returns an error.

Remarks

The READDEF service reads a value from the registry, but you will never receive an error using this service. To read a key's default value, set the ValueName to "". To read a specific value within a key, set ValueName to the target value's name.

As the name implies, you supply a default value to be used in the event that the registry key or value name is not found. The default value is supplied via the Value parameter. Unlike the READ service, the READDEF service always returns the results from the function, never via the Value parameter.

Example

* Read a value from the registry without error checking
Value = SRP_Registry("READDEF", "HKCU\Software\MyApp", "ShowFullscreen", 1) 

* Read a default value without error checking
Value = SRP_Registry("READDEF", "HKCU\Software\MyApp", "", "Default")