# Delete Key
> [HTML Version](deletekey.htm)
**xcall MIAMEX, MX\_REGISTRY, REGOP\_DELKEY, hkey, subkey, rights, status**
This function deletes a registry key.
_hkey_ (B,4) \[in\]
must specify an open registry handle returned from a previous REGOP\_OPEN operation (or may be one of the built-in hive handles, e.g., HKEY\_CURRENT\_USER, etc.) Note that to delete a key, the the RGKEY\_DELETE access right must have been specified in the REGOP\_OPEN call. To delete a value, the RGKEY\_SET\_VALUE access right must have been specified in the open.
_subkey_ ([String](string.htm.md)) \[in\]
specifies the key to delete (within HKEY). All values within the key will be deleted, but if there are any nested subkeys, the operation will fail. To delete a multi-level tree, you must start from the lowest level and work up.
_rights_ ([Num](num.htm.md)) \[in\]
only applies when running in 64 bit Windows, in which case it can be used to select the registry view:
RGKEY\_WOW64\_32KEY \&h0200 Delete key from 32 bit registry view
RGKEY\_WOW64\_64KEY \&h0100 Delete key from 64 bit registry view
_status_ (F6) \[out\]
returns 0 for success, else an error code.