Export (0) Print
Expand All

RegDeleteKey

Windows Mobile 6.5
A version of this page is also available for
4/8/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).


LONG RegDeleteKey( 
  HKEY hKey, 
  LPCWSTR lpSubKey 
);

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.

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.

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.

Headerwinreg.h
Librarycoredll.lib
Windows Embedded CEWindows CE 1.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

ADD
Show:
© 2014 Microsoft