Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Edge HMI

SetRegValue

  • Last UpdatedOct 29, 2026
  • 1 minute read

Sets the value of a variable in the Windows registry.

Function

Group

Execution

String Exp.

Windows

Windows Embedded

IoT View

Thin Clients

Mobile Access

SetRegValue

System Info

Synchronous

No

Supported

Supported

Not 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, "HARDWARE\DEVICEMAP\SERIALCOMM", "\Device\Serial1", 1, "COM3" ) // Returned value = 0 if successful

Tag

SetRegValue( 2, "Control Panel\Desktop", "Smooth Scroll", 0, 1 ) // Returned value = 0 if successful

Note: 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.

In This Topic