setRegRoot
Syntax
- int setRegRoot(int hKey)
Arguments
- hKey
- The section of the registry you want to access. hKey can be set to either HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER, depending which section you need to access.
Return
- Returns ERROR_SUCCESS if the operation was successful, otherwise it returns one of the following integer error codes:
ERROR_SUCCESS | (==0) no error |
ERROR_FILE_NOT_FOUND | key or value name not found |
ERROR_MORE_DATA | buffer wasn't big enough (e.g., getRegString, getRegData) |
ERROR_NO_MORE_ITEMS | index >= # of values or subkeys (enumRegValue, enumRegSubKey) |
ERROR_INVALID_FUNCTION | bad top-level key, etc |
ERROR_INVALID_DATA | wrong data type or size (or size > 2048) |
ERROR_BADDB | registry database is corrupt |
ERROR_BADKEY | registry key is invalid |
ERROR_CANTOPEN | registry key could not be opened |
ERROR_CANTREAD | registry key could not be read |
ERROR_CANTWRITE | registry key could not be written |
ERROR_REGISTRY_CORRUPT | registry is corrupt |
ERROR_REGISTRY_IO_FAILED | input/output to registry failed |
ERROR_KEY_DELETED | Illegal operation attempted on a Registry key which has been marked for deletion. |
ERROR_KEY_HAS_CHILDREN | cannot delete a key with subkeys (Windows NT) |
Description
- Sets the the current registry root key.
- Currently, only two types of registry roots are possible, identified by the constants (HKEY_LOCAL_MACHINE)? and (HKEY_CURRENT_USER)?.
Example
// Sets the registry key and path back to the FM default values.
setRegRoot(HKEY_CURRENT_USER);
setRegPath("Software\\!O\\!C\\!t");
Also see
- getRegRoot, setRegPath
Comments
- Everyone can add his comments about his experiences with this function here. Tips for using it are welcome, too.