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

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