Compartir a través de


IXpsOMDictionary::SetAt method

Replaces the entry at a specified location in the dictionary.

Syntax

HRESULT SetAt(
  [in] UINT32          index,
  [in] LPCWSTR         key,
  [in] IXpsOMShareable *entry
);

Parameters

  • 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 code Description
S_OK

The method succeeded.

XPS_E_NO_CUSTOM_OBJECTS

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

 

Remarks

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

Requirements

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]

Header

Xpsobjectmodel.h

IDL

XpsObjectModel.idl

See also

IXpsOMDictionary

IXpsOMShareable

XPS Document Errors

XML Paper Specification