Partager via


RegDeleteKey (Windows Embedded CE 6.0)

1/6/2010

This function deletes a specified registry key and all its subkeys.

A remote application interface (RAPI) version of this function exists called CeRegDeleteKey (RAPI).

Syntax

LONG RegDeleteKey( 
  HKEY hKey, 
  LPCWSTR lpSubKey 
);

Parameters

  • hKey
    [in] Handle to a currently open key or one of the following predefined reserved handle values:

    • HKEY_LOCAL_MACHINE
    • HKEY_CLASSES_ROOT
    • HKEY_CURRENT_USER
    • HKEY_USERS

    The key specified by the lpSubKey parameter must be a subkey of the key identified by this parameter.

  • lpSubKey
    [in] Pointer to a null-terminated string specifying the name of the key to delete. This parameter cannot be set to NULL.

Return Value

ERROR_SUCCESS indicates success. A nonzero error code defined in Winerror.h indicates failure. To get a generic description of the error, call the FormatMessage funciton with the FORMAT_MESSAGE_FROM_SYSTEM flag set. The message resource is optional, so FormatMessage might fail.

Remarks

If this function succeeds, it removes the specified key, including all its values and subkeys, from the registry. An application cannot call this function for a key that an application currently has open.

To open the key, use the RegCreateKeyEx or the RegOpenKeyEx function.

Requirements

Header winreg.h
Library coredll.lib
Windows Embedded CE Windows CE 1.0 and later

See Also

Reference

Registry Functions
RegCloseKey
RegCreateKeyEx
RegOpenKeyEx

Other Resources

State and Notifications Broker