IWMSContext::GetIndexedValue
Previous | Next |
IWMSContext::GetIndexedValue
The GetIndexedValue method retrieves a specific name-value pair, by index, from the context.
Syntax
HRESULT GetIndexedValue( long lIndex, LPWSTR* pstrName, long* plNameHint, VARIANT* pValue, long* plResultOptions, long lOptions );
Parameters
lIndex
[in] long integer containing the index.
pstrName
[out] Pointer to an LPWSTR containing the name portion of the name-value pair.
plNameHint
[out] long containing an optional key that can be used to more efficiently access a value.
pValue
[out] Pointer to a VARIANT containing the value.
plResultOptions
[out] Reserved for future use.
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 lIndex parameter could not be found. |
E_OUTOFMEMORY | 0x8007000E | Could not allocate memory to return the name of the property in the pstrName parameter. |
Remarks
The GetIndexedValue method allocates memory for the name of the property by calling the CoTaskMemAlloc function. You must release this memory by using the CoTaskMemFree function.
Example Code
// Declare variables. LPWSTR* lpstrName = NULL; CComVariant varValue; // Use a pointer to a context to retrieve a value // by index. HRESULT hr = pContext->GetIndexedValue( i, &lpstrName, NULL, &varValue, NULL, 0 ); if( SUCCEEDED( hr ) ) { switch( V_VT( &varValue ) ) { case VT_I4: { // TODO: Process the case. } case VT_UNKNOWN: { // TODO: Process the case. } case VT_CY: { // TODO: Process the case. } case VT_BSTR: { // TODO: Process the case. } case VT_DATE: { // TODO: Process the case. } } } EXIT: // Release memory allocated for the lpstrName string. CoTaskMemFree(lpstrName); // 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 |