Skip to content

Latest commit

 

History

History
61 lines (42 loc) · 1.33 KB

RegDeleteKey.md

File metadata and controls

61 lines (42 loc) · 1.33 KB

Home

Function name : RegDeleteKey

Group: Registry - Library: advapi32


The RegDeleteKey function deletes a subkey, including all of its values.


Code examples:

Class library providing access to the System Registry

Declaration:

LONG RegDeleteKey(
  HKEY hKey,
  LPCTSTR lpSubKey
);  

FoxPro declaration:

DECLARE INTEGER RegDeleteKey IN advapi32;
	INTEGER hKey,;
	STRING  lpSubKey  

Parameters:

hKey [in] Handle to an open key.

lpSubKey [in] Pointer to a null-terminated string specifying the name of the key to be deleted.


Return value:

If the function succeeds, the return value is ERROR_SUCCESS (0).


Comments:

The key must have been opened with the DELETE access right.

hKey handle is returned by the RegCreateKeyEx or RegOpenKeyEx function, or it can be one of the following predefined keys:
HKEY_CLASSES_ROOT
HKEY_CURRENT_CONFIG
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS

The subkey to be deleted must not have subkeys. To delete a key and all its subkeys, you need to recursively enumerate the subkeys and delete them individually. To recursively delete keys, use the SHDeleteKey function.