IWMSContext::CopyValues

banner art

Previous Next

IWMSContext::CopyValues

The CopyValues method copies the specified properties from one context to another.

Syntax

  HRESULT CopyValues(
  IWMSContext*  pDest,
  LPCWSTR*  pstrName,
  long*  lNameHint,
  long  lNames
);

Parameters

pDest

[in] Pointer to an IWMSContext interface that you are copying properties to.

pstrName

[in] Pointer to an array of LPCWSTR values that contains the property names that you are copying.

lNameHint

[in] Pointer to an array of long values that contains the hints associated with the property names you are copying.

lNames

[in] long containing the number of values being copied.

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 pointer identified by the pDest parameter cannot be the this pointer.

Example Code

// Declare variables.
IWMSContext* pNewUserContext = NULL;
long rlUserContextNameHints[] = {
                        WMS_USER_AGENT_ID,
                        WMS_USER_GUID_ID,
                        };
LPCWSTR rlUserContextNames[] = {
                        WMS_USER_AGENT,
                        WMS_USER_GUID,
                        };

// Use an IWMSClassObject pointer to create a new user context.
// The server passes the IWMSClassObject pointer when it calls
// the IWMSBasicPlugin::InitializePlugin method.
if(NULL != pClassFactory)
{
    hr = pClassFactory->AllocIWMSContext( IID_IWMSContext,
                                          WMS_USER_CONTEXT_TYPE,
                                          NULL,
                                          ( void ** ) &pNewUserContext
                                         );

    if (FAILED(hr)) goto EXIT;
}

// Copy the user agent and the user GUID from the existing user 
// context to the new user context.
if (NULL != pUserContext)
{
    hr = pUserContext->CopyValues( pNewUserContext,
                                   rlUserContextNames,
                                   rlUserContextNameHints,
                                   sizeof(rlUserContextNames)/sizeof(rlUserContextNames[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