IXpsOMPage::GenerateUnusedLookupKey method

Generates a unique name that can be used as a lookup key by a resource in a resource dictionary.

Syntax

HRESULT GenerateUnusedLookupKey(
  [in]          XPS_OBJECT_TYPE type,
  [out, retval] LPWSTR          *key
);

Parameters

  • type [in]
    The type of IXpsOMShareable object for which the lookup key is generated.

  • key [out, retval]
    The lookup key string that is generated by this method.

Return value

If the method succeeds, it returns S_OK; otherwise, it returns an HRESULT error code.

Return code Description
S_OK

The method succeeded.

E_POINTER

key is NULL.

E_INVALIDARG

type refers to an object type that is not recognized.

 

Remarks

To be unique in the dictionary, the string generated by GenerateUnusedLookupKey consists of a prefix string that is based on the object type and is followed by four unique alphanumeric characters.

The prefix string for each object type is shown in the following table.

Object type Prefix string for this object type

XPS_OBJECT_TYPE_CANVAS

Canvas_

XPS_OBJECT_TYPE_GEOMETRY

Geometry_

XPS_OBJECT_TYPE_GLYPHS

Glyphs_

XPS_OBJECT_TYPE_IMAGE_BRUSH

IBrush_

XPS_OBJECT_TYPE_LINEAR_GRADIENT_BRUSH

LGBrush_

XPS_OBJECT_TYPE_MATRIX_TRANSFORM

MTransform_

XPS_OBJECT_TYPE_PATH

Path_

XPS_OBJECT_TYPE_RADIAL_GRADIENT_BRUSH

RGBrush_

XPS_OBJECT_TYPE_SOLID_COLOR_BRUSH

SCBrush_

XPS_OBJECT_TYPE_VISUAL_BRUSH

VBrush_

 

Note  

This method returns a key string that is unique within the context of this page. It is not guaranteed to return a key that is unique in a remote dictionary resource that could be used by more than one page.

 

This method allocates the memory used by the string that is returned in key. If key is not NULL, use the CoTaskMemFree function to free the memory.

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

IXpsOMPage

XPS_OBJECT_TYPE

XML Paper Specification