## wb_set_registry_key

Special warning about wb_set_registry_key() This function provides direct access to the Windows Registry and should be used with great care. This function has the potential to corrupt the Windows Registry, create unexpected behaviors or even render your system useless. Always be careful and double-check your source code before running it when using this function.

bool wb_set_registry_key (string key, string subkey [, string entry [, mixed value]])

Writes a string or integer value to the Windows registry item referenced by key, subkey and entry. The subkey may contain forward or reverse slashes. If entry is an empty string, a NULL value or is not supplied, the function sets the default value for the subkey. value may be a string, an integer or a floating-point type (floats are converted to strings). If the entry does not exist, the function creates it. If value is NULL, deletes the entry.

The key string can be one of the following values:

"HKCU" or "HKEY_CURRENT_USER"
"HKLM" or "HKEY_LOCAL_MACHINE"
"HKCR" or "HKEY_CLASSES_ROOT"
"HKU" or "HKEY_USERS"
"HKCC" or "HKEY_CURRENT_CONFIG"
"HKD" or "HKEY_DYN_DATA"

NOTES

- Registry keys, subkeys and entries are not case-sensitive.
- Floats are converted to strings for storage. To retrieve a float, cast the result using (float)wb_set_registry_key(). See registry.phpw for an example.

Example

`// Creates or sets various values wb_set_registry_key("HKCU", "Software\\WinBinder", "String value", "1234"); wb_set_registry_key("HKCU", "Software\\WinBinder", "Integer value", 1234); wb_set_registry_key("HKCU", "Software\\WinBinder", "Floating-point value", 1.234); wb_set_registry_key("HKCU", "Software\\WinBinder", "", "The default");` `// Delete the new entries` `wb_set_registry_key("HKCU", "Software\\WinBinder", "String value", null); wb_set_registry_key("HKCU", "Software\\WinBinder", "Integer value"); wb_set_registry_key("HKCU", "Software\\WinBinder", "Floating-point value"); wb_set_registry_key("HKCU", "Software\\WinBinder", "");`

See also

wb_get_registry_key
System functions