SYS_SetRegistryValue Function


Sets the data value of an item in the Windows registry.


Windows platforms


SYS_SetRegistryValue (iKey, sPath, sItem, sValue)
Variable Description
iKey The registry key. INTEGER
sPath The path to the item through the registry hierarchy. STRING.
sItem The name of the data value to set. STRING.
sValue The data value of the item. STRING.


SYS_SetRegistryValue sets values of existing registry items but does not allow you to create new registry items.

Use the include file to be able to reference key values.

SYS_SetRegistryValue can be called from Silk Test Classic or Agent C code, which might be useful if you want to put your application’s runtime settings in the registry.

SYS_SetRegistryValue supports these three data types: REG_SZ (string), REG_DWORD (4-byte binary value), and REG_BINARY (binary value of arbitrary length). If you want to set an item that has a value of type REG_BINARY or REG_DWORD, then you must format the value within a string that includes the data type prefix, as shown in the following examples:

"REG_BINARY: 14 00 00 7e 8f 99 33 22 08 00 07 00 06"
"REG_DWORD: 0x00008f7e"

SYS_SetRegistryValue is executed by the Agent process, not the Silk Test Classic process. To affect the host process, use the function with the hHost notation or machine handle operator. For more information about the machine handle operator and hHost, see Machine handle operator.


The following code fragment sets the RGB values for scroll bars.

integer iKey = HKEY_CURRENT_USER // defined in
string sPath = "Control Panel\Colors"
string sItem = "Scrollbar"
SYS_SetRegistryValue (iKey, sPath, sItem, "255 255 255")