IWMSContext::GetValue
.gif)
| Previous | Next |
IWMSContext::GetValue
The GetValue method retrieves a VARIANT containing the value assigned to a name-value pair in the context.
Syntax
HRESULT GetValue( LPCWSTR pstrName, long lNameHint, VARIANT* 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
[out] Pointer to the VARIANT value portion of the name-value pair.
lOptions
[in] long containing either zero or the WMS_CONTEXT_GET_PROPERTY_STRING_BY_REFERENCE enumeration flag to indicate that the variant must be retrieved by reference. This flag is defined in the WMS_CONTEXT_OPTIONS enumeration type. If this parameter is zero, the variant is retrieved by value.
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. |
| E_POINTER | 0x80004003 | The pValue parameter is NULL. |
Remarks
If you specify WMS_CONTEXT_GET_PROPERTY_STRING_BY_REFERENCE for the lOptions parameter, you must not free the variant allocated by this method or use the CComVariant class.
Example Code
// Declare variables. Use of CComVariant is permitted because
// the lFlags parameter is not set.
CComVariant VariantValue;
// Retrieve the playback rate.
if (NULL != pRequestContext)
{
hr = pRequestContext->GetValue(
WMS_COMMAND_CONTEXT_RATE,
WMS_COMMAND_CONTEXT_RATE_ID,
&VariantValue,
0
);
if( SUCCEEDED( hr ) )
{
if( VT_R8 != VariantValue.vt )
{
hr = E_INVALIDARG;
goto EXIT;
}
}
}
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 |