Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
.gif)
| Previous | Next |
IWMSContext::GetStringValue
The GetStringValue method retrieves a String value from the specified context.
Syntax
HRESULT GetStringValue( LPCWSTR pstrName, long lNameHint, LPWSTR* pstrValue, 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.
pstrValue
[out] Pointer to the string value.
lOptions
[in] long containing either zero or the WMS_CONTEXT_GET_PROPERTY_STRING_BY_REFERENCE enumeration flag to indicate that the string must be retrieved by reference. This flag is defined in the WMS_CONTEXT_OPTIONS enumeration type. If this parameter is zero, the string 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. |
| DISP_E_TYPEMISMATCH | 0x80020005 | The data type of the property specified by the pstrName parameter is not VT_LPWSTR. |
| E_POINTER | 0x80004003 | The pstrValue parameter is NULL. |
Remarks
The GetStringValue method allocates memory for the name of the property by calling the CoTaskMemAlloc function. If you do not use the WMS_CONTEXT_GET_PROPERTY_STRING_BY_REFERENCE enumeration value, you must release this memory by using the CoTaskMemFree function.
Example Code
// Declare variables.
HRESULT hr = S_OK;
LPWSTR wstrUserAgent = NULL;
// Retrieve the user agent.
if (NULL != pUserContext)
{
hr = pUserContext->GetStringValue(
WMS_USER_PROXY_CLIENT_AGENT,
WMS_USER_PROXY_CLIENT_AGENT_ID,
&wstrUserAgent,
WMS_CONTEXT_GET_PROPERTY_STRING_BY_REFERENCE
);
if(FAILED(hr) || (NULL==wstrUserAgent)) goto EXIT;
}
EXIT:
// TODO: Release temporary objects and uninitialize COM.
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 |