Function Reference


_WinAPI_RegDeleteTreeEx

Deletes the subkeys and values of the specified key recursively

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

Parameters

$hKey Handle to an open registry key.
The key must have been opened with the following access rights $STANDARD_RIGHT_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:
    $HKEY_CLASSES_ROOT
    $HKEY_CURRENT_CONFIG
    $HKEY_CURRENT_USER
    $HKEY_LOCAL_MACHINE
    $HKEY_USERS
$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.

Remarks

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.

Related

_WinAPI_RegCreateKey, _WinAPI_RegOpenKey, _WinAPI_RegDeleteKey, _WinAPI_RegDeleteTree

See Also

Search RegDeleteTree in MSDN Library.