CRegKey::SetStringValue

Call this method to set the string value of the registry key.

LONG SetStringValue(
   LPCTSTR pszValueName,
   LPCTSTR pszValue,
   DWORD dwType = REG_SZ 
) throw( );

Parameters

  • pszValueName
    Pointer to a string containing the name of the value to set. If a value with this name is not already present, the method adds it to the key.

  • pszValue
    Pointer to the string data to be stored with the specified value name.

  • dwType
    The type of the string to write to the registry: either REG_SZ (the default) or REG_EXPAND_SZ (for multistrings).

Return Value

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

Remarks

This method uses RegSetValueEx to write the value to the registry.

Requirements

Header: atlbase.h

See Also

Concepts

CRegKey Class

CRegKey Members

CRegKey::QueryStringValue

CRegKey::SetDWORDValue

CRegKey::SetQWORDValue

CRegKey::SetGUIDValue

CRegKey::SetMultiStringValue

CRegKey::SetBinaryValue