Dela via


CRegKey::SetKeyValue

Call this method to store data in a specified value field of a specified key.

LONG SetKeyValue(
   LPCTSTR lpszKeyName,
   LPCTSTR lpszValue,
   LPCTSTR lpszValueName = NULL 
) throw( );

Parameters

  • lpszKeyName
    Specifies the name of the key to be created or opened. This name must be a subkey of m_hKey.

  • lpszValue
    Specifies the data to be stored. This parameter must be non-NULL.

  • lpszValueName
    Specifies the value field to be set. If a value field with this name does not already exist in the key, it is added.

Return Value

If successful, returns ERROR_SUCCESS; otherwise, a nonzero error code defined in WINERROR.H.

Remarks

Call this method to create or open the lpszKeyName key and store the lpszValue data in the lpszValueName value field.

Requirements

Header: atlbase.h

See Also

Reference

CRegKey Class

CRegKey::SetValue

Other Resources

CRegKey Members