IWICMetadataQueryWriter::SetMetadataByName method (wincodec.h)

Sets a metadata item to a specific location.

Syntax

HRESULT SetMetadataByName(
  [in] LPCWSTR           wzName,
  [in] const PROPVARIANT *pvarValue
);

Parameters

[in] wzName

Type: LPCWSTR

The name of the metadata item.

[in] pvarValue

Type: const PROPVARIANT*

The metadata to set.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

SetMetadataByName uses metadata query expressions to remove metadata. For more information on the metadata query language, see the Metadata Query Language Overview.

If the value set is a nested metadata block then use variant type VT_UNKNOWN and pvarValue pointing to the IWICMetadataQueryWriter of the new metadata block.
The ordering of metadata items is at the discretion of the query writer since relative locations are not specified.

Requirements

Requirement Value
Minimum supported client Windows XP with SP2, Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header wincodec.h
Library Windowscodecs.lib
DLL Windowscodecs.dll

See also

Conceptual

How-to: Re-encode a JPEG Image with Metadata

IWICMetadataQueryWriter

Metadata Query Language Overview

Other Resources

Overview of Reading and Writing Image Metadata

PROPVARIANT

WIC Metadata Overview