Function Reference


Deletes the subkeys and values of the specified key recursively

#include <WinAPIReg.au3>
_WinAPI_RegDeleteTreeEx ( $hKey [, $sSubKey = 0] )


$hKey Handle to an open registry key. The key must have been opened with the following access rights:
$DELETE, $KEY_ENUMERATE_SUB_KEYS, and $KEY_QUERY_VALUE. This handle is returned by the _WinAPI_RegCreateKey()
or _WinAPI_RegOpenKey() function, or it can be one of the following predefined keys.
$sSubKey [optional] The name of the key to delete. This key must be a subkey of the key identified by the $hKey parameter.
If this parameter is not specified (Default), the subkeys and values of $hKey are deleted.

Return Value

Success: 1.
Failure: 0 and sets the @error flag to non-zero, @extended flag may contain the system error code.


If the key has values, it must be opened with $KEY_SET_VALUE or this function will fail.

This function requires Windows Vista or later.


_WinAPI_RegCreateKey, _WinAPI_RegOpenKey

See Also

Search RegDeleteTree in MSDN Library.