IWMSContext::GetAndQueryIUnknownValue

banner art

Previous Next

IWMSContext::GetAndQueryIUnknownValue

The GetAndQueryIUnknownValue method retrieves an IUnknown pointer and calls QueryInterface to retrieve a pointer to the specified interface.

Syntax

  HRESULT GetAndQueryIUnknownValue(
  LPCWSTR  pstrName,
  long  lNameKey,
  REFIID  riid,
  IUnknown**  pResult,
  long  lOptions
);

Parameters

pstrName

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

lNameKey

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

riid

[in] REFIID containing the GUID identifying the requested interface.

pResult

[out] Pointer to the requested interface.

lOptions

[in] Reserved for future use.

Return Values

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

Return code Number Description
DISP_E_BADINDEX 0x8002000B The property specified by the pstrName parameter could not be found.
DISP_E_TYPEMISMATCH 0x80020005 The data type of the property specified by the pstrName parameter is not VT_UNKNOWN.
E_POINTER 0x80004003 The pResult parameter is NULL.

Example Code

// Retrieve a pointer to an IWMSServer interface by using
// a pointer to the server context.
hr = pServerContext->GetAndQueryIUnknownValue( 
                            const_cast<LPWSTR>( WMS_SERVER ),
                            WMS_SERVER_ID,
                            IID_IWMSServer, 
                            (IUnknown**)&pWMSServer, 
                            0 );

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