Writes a value to the registry.

Syntax

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

Returns

1 if the value was written successfully, 0 if there was an error.

Value

The Value parameter must contain the new value to be written. The value will be applied to the given Key and ValueName.

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 create key"The key could not be opened or creating.
"Failed to write value"The value could not be written to ValueName.

Remarks

The WRITE service writes a value to the registry. If the Key you supply doesn't already exist, it is created. Likewise, if the ValueName you supply doesn't exist, it is created. To write to a key's default value, set the ValueName to "". To write a specific value within a key, supply a new or existing ValueName. Assuming both the key and value name created successfully, the value will be set to the Value parameter. SRP_Registry will return 1 if the new value was successfully written or 0 if there was an error.

Example

* Write a value to the registry
If SRP_Registry("WRITE", "HKCU\Software\MyApp", "ShowFullscreen", 1, Error) EQ 0 then
   Msg(@Window, "WRITE Error: ":Error:@FM:@FM:@FM:4)
end

* Write to a key's default value in the registry
If SRP_Registry("WRITE", "HKCU\Software\MyApp", "", "NewValue", Error) EQ 0 then
   Msg(@Window, "WRITE Error: ":Error:@FM:@FM:@FM:4)
end
  • No labels