The RegCreateKey function creates the specified key. If the key already exists in the registry, the function opens it. This function is provided for compatibility with Windows version 3.1. Win32-based applications should use the RegCreateKeyEx function.
LONG RegCreateKey(
HKEY hKey, |
// handle of an open key |
LPCTSTR lpSubKey, |
// address of name of subkey to open |
PHKEY phkResult |
// address of buffer for opened handle |
); |
HKEY_CLASSES_ROOT
HKEY_CURRENT_CONFIG
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
Windows NT only: HKEY_PERFORMANCE_DATA
Windows 95 only: HKEY_DYN_DATA
The key opened or created by the RegCreateKey function is a subkey of
the key identified by hKey.
If hKey is one of the predefined keys, lpSubKey may be NULL. In
that case, the handle returned by using phkResult is the same hKey
handle passed in to the function.
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value is a nonzero error code defined in WINERROR.H. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.
An application can use the RegCreateKey function to create several keys at once. For example, an application can create a subkey four levels deep at the same time as the three preceding subkeys by specifying a string of the following form for the lpSubKey parameter:
subkey1\subkey2\subkey3\subkey4
The key identified by the hKey parameter must have been opened with KEY_CREATE_SUB_KEY access (KEY_WRITE access includes KEY_CREATE_SUB_KEY access).
If the lpSubKey parameter is the address of an empty string, the function opens and then passes back the key identified by the hKey parameter.
RegCloseKey, RegCreateKeyEx, RegDeleteKey, RegOpenKey, RegOpenKeyEx, RegSetValue
file: /Techref/os/win/api/win32/func/src/f72_3.htm, 4KB, , updated: 2000/4/7 11:19, local time: 2024/11/8 17:22,
18.224.73.124:LOG IN ©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://linistepper.com/Techref/os/win/api/win32/func/src/f72_3.htm"> RegCreateKey</A> |
Did you find what you needed? |