Share via


CRegKey::DeleteSubKey

Call this method to remove the specified key from the registry.

LONG DeleteSubKey( 
   LPCTSTR lpszSubKey  
) throw( );

Parameters

  • lpszSubKey
    Specifies the name of the key to delete. This name must be a subkey of m_hKey.

Return Value

If successful, returns ERROR_SUCCESS. If the method fails, the return value is a nonzero error code defined in WINERROR.H.

Remarks

DeleteSubKey can only delete a key that has no subkeys. If the key has subkeys, call RecurseDeleteKey instead.

Requirements

Header: atlbase.h

See Also

Reference

CRegKey Class

CRegKey::DeleteValue