IWMSContext::SetIUnknownValue

banner art

Previous Next

IWMSContext::SetIUnknownValue

The SetIUnknownValue method specifies an IUnknown value in the context.

Syntax

  HRESULT SetIUnknownValue(
  LPCWSTR  pstrName,
  long  lNameHint,
  IUnknown*  pValue,
  long  lOptions
);

Parameters

pstrName

[in] LPCWSTR specifying the name portion of the name-value pair in the context.

lNameHint

[in] long containing an optional key that can be used to more efficiently access a value.

pValue

[in] IUnknown pointer in the context.

lOptions

[in] long containing either zero or the WMS_CONTEXT_SET_PROPERTY_NAME_BY_VALUE enumeration flag defined in the WMS_CONTEXT_OPTIONS enumeration type. By default, the name is specified by reference.

Return Values

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

Return code Number Description
E_INVALIDARG 0x80070057 The pstrName parameter is NULL.
E_OUTOFMEMORY 0x8007000E Could not allocate memory for the value.

Example Code

// Specify an IUnknown pointer to the CCacheEntry class in
// the presentation context. In this example, CCacheEntry is 
// a user-defined class that contains information about
// a cached item.
if (NULL != pPresentationContext)
{
    hr = pPresentationContext->SetIUnknownValue( 
                                   L"CacheEntry", 
                                   WMS_CONTEXT_NO_NAME_HINT,
                                   pCacheEntry,
                                   WMS_CONTEXT_SET_PROPERTY_NAME_BY_VALUE
                                                );
    if (FAILED(hr)) goto EXIT;
}

EXIT:
    // TODO: Release temporary objects.

Requirements

Header: wmscontext.h.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.

See Also

Previous Next