Function Reference


Sets the data and type of a specified value under a registry key

#include <WinAPIReg.au3>
_WinAPI_RegSetValue ( $hKey, $sValueName, $iType, $tValueData, $iBytes )


$hKey Handle to an open registry key. The key must have been opened with the $KEY_SET_VALUE access right.
This handle is returned by the _WinAPI_RegCreateKey() or _WinAPI_RegOpenKey() function. It can also
be one of the following predefined keys.
$sValueName The name of the value to be set. If a value with this name is not already present in the key,
the function adds it to the key. If $sValueName is empty string, the function sets the type and
data for the key's unnamed or default value.
$iType The type of data. This parameter can be one of the following values.
$tValueData The structure (buffer) that contains the data to be stored. For string-based types, such as REG_SZ,
the string must be null-terminated. With the REG_MULTI_SZ data type, the string must be terminated
with two null characters. A backslash must be preceded by another backslash as an escape character.
For example, specify "C:\\mydir\\myfile" to store the string "C:\mydir\myfile".
$iBytes The size of the data, in bytes. If the data has the REG_SZ, REG_MULTI_SZ or REG_EXPAND_SZ type,
this size includes any terminating null character or characters unless the data was stored
without them.

Return Value

Success: 1.
Failure: 0 and sets the @error flag to non-zero, @extended flag may contain the system error code.


_WinAPI_RegCreateKey, _WinAPI_RegOpenKey

See Also

Search RegSetValueEx in MSDN Library.