173
SetVariableById
SetVariableById
SetVariableById
SetVariableById ( VarId, Name, Type, Defau
( VarId, Name, Type, Defau
( VarId, Name, Type, Defau
( VarId, Name, Type, Default, Value, Persist )
lt, Value, Persist )
lt, Value, Persist )
lt, Value, Persist )
Modifies a Variable, specified by its ID.
Syntax
HRESULT SetVariableById(
[in] long VarId,
[in] BSTR Name,
[in] long Type,
[in] BSTR Default,
[in] BSTR Value,
[in] long Persist,
[out, retval] VARIANT_BOOL* Success
);
Parameters
VarId
[in] ID of the Variable.
Name
[in] Name of the specified Variable (can be modified).
Type
[in] Variable type.
Default
[in] Default value for the Variable.
Value
[in] Current value for the Variable.
Persist
[in] Set to 1 to make the Variable persistent. Set to 0 otherwise.
Success
[out, retval] TRUE if specified Variable settings were updated, FALSE if updating the
Variable failed.
Remarks
Variable names consist of letters, numbers, and the underscore. All other characters are not permitted.
Default and Value
The returned value is a string that represents the stored value of the Variable. The string value will need to be
converted by the caller into the actual type, e.g. a Variable of type
long
.
The format for the returned string depends on the Variable’s type (see
GetVariableType ( VarId )
page
171
).
Persistence
When a Variable is persistent, the value of the Variable is stored to permanent storage each time it is changed.
So, if the device is reset or the power is turned off, the Variable will still have its last value when the system
restarts.
If the Variable is not persistent, then the Variable’s value is set to its default whenever the system restarts.
SetVariableByName ( Name, Type, Default, Value, Persist )
SetVariableByName ( Name, Type, Default, Value, Persist )
SetVariableByName ( Name, Type, Default, Value, Persist )
SetVariableByName ( Name, Type, Default, Value, Persist )
Modifies a Variable, specified by its name.