SetRegValue

Sets the value of a variable in the Windows registry.

Function Group Execution Windows Embedded Thin Client Mobile Access
SetRegValue System Info Synchronous Supported Supported Not supported Not supported

Syntax

  SetRegValue( numMainKey, strKey, strVariableName, numType, strOrNumValue )  
numMainKey
Numeric tag with the following possible values:
0 HKEY_LOCAL_MACHINE
1 HKEY_CLASSES_ROOT
2 HKEY_CURRENT_USER
3 HKEY_USERS
4 HKEY_CURRENT_CONFIG
5 HKEY_PERFORMANCE_DATA
strKey
Path where the value is located in the Main Key.
strVariableName
Name of the variable to be set. The maximum length is 255 characters.
numType
Two types are currently supported:
0 DWord
1 String
strOrNumValue
Variable value.

Returned value

0 Success.
−1 Invalid number of parameters or invalid Main Key.
−2 Invalid type.
−3 Failed to read the variable value; verify that you have the proper security rights.

Examples

Tag Name Expression
Tag SetRegValue( 0, “HARDWAREDEVICEMAPSERIALCOMM”, “DeviceSerial1″, 1, “COM3″ ) // Returned value = 0 if successful
Tag SetRegValue( 2, “Control PanelDesktop”, “Smooth Scroll”, 0, 1 ) // Returned value = 0 if successful
CAUTION:
This register can affect the Windows system configuration. You should be extremely careful and edit the registry only when you are certain about the configuration.

SetRegValue