IXpsOMDictionary::SetAt method

Replaces the entry at a specified location in the dictionary.


  [in] UINT32          index,
  [in] LPCWSTR         key,
  [in] IXpsOMShareable *entry


index [in]

The zero-based index in the dictionary in which an entry is to be replaced.

key [in]

The key to be used for the new entry.

The string referenced by key must be unique in the dictionary.

entry [in]

The IXpsOMShareable interface pointer that will replace current contents at the location specified by index.

A dictionary cannot contain duplicate interface pointers. This parameter must contain an interface pointer that is not already in the dictionary.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the table that follows. For information about XPS document API return values that are not listed in this table, see XPS Document Errors.

Return codeDescription

The method succeeded.


entry does not point to a recognized interface implementation. Custom implementation of XPS Document API interfaces is not supported.



At the location specified by index, this method releases the IXpsOMShareable interface referenced by the existing pointer, then replaces it with the interface pointer that is passed in entry and assigns it the key passed in key.

The interface pointers stored in a dictionary will usually point to interfaces, such as IXpsOMBrush and IXpsOMVisual, that are derived from the IXpsOMShareable interface. To determine the interface type, call the GetType method.

The figure that follows illustrates how the dictionary is changed by the SetAt method.

A figure that shows how RemoveAt removes an entry from the dictionary


Minimum supported client

Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | Windows Store apps]





See also

XPS Document Errors
XML Paper Specification