Reads a value from the registry.

Syntax

Status = SRP_Registry("READ", Key, ValueName, Value, Error)

Returns

1 if the value was found and read successfully, 0 if there was an error.

Value

The value parameter is output only. Pass a variable to the Value parameter to receive the read value.

Errors

If the service returns 0, then an error occurred. In this event, the Error parameter can be one of the following messages:

ErrorDescription
"Failed to open key"The key could not be found and opened.
"Failed to read value"The value identified by ValueName could not be found and read.

Remarks

The READ service reads a value from the registry. 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. If the value is found, then it is returned via the Value parameter. If the value was successfully read, then the return value is 1. If the value could not be read due to an error, then the return value is 0 and the Error parameter contains the error.

If you don't want to bother with error checking, then use the alternative READDEF service.

Example

* Read a value from the registry
If SRP_Registry("READ", "HKCU\Software\MyApp", "ShowFullscreen", Value, Error) EQ 0 then
   Msg(@Window, "READ Error: ":Error:@FM:@FM:@FM:4)
end

* Read a default value from the registry
If SRP_Registry("READ", "HKCU\Software\MyApp", "", Value, Error) EQ 0 then
   Msg(@Window, "READ Error: ":Error:@FM:@FM:@FM:4)
end
  • No labels