Share via


GetContextPropertyValue Function

GetContextPropertyValue Function

Returns a specified property value from the recognizer context.

Syntax

[C++]

HRESULT WINAPI GetContextPropertyValue(
  HRECOCONTEXT hrc,
  GUID *pPropertyGUID,
  ULONG *pcbSize,
  BYTE *pProperty
);

Parameters

hrc

[in] Handle to the recognizer context.

pPropertyGUID

[in] Identifies the property to retrieve. Specify a predefined property globally unique identifier (GUID) or application-defined GUID. For a list of predefined properties, see the recognition Property GUIDs.

pcbSize

[in, out] On input, the size, in bytes, the pProperty buffer can be. On output, the size, in bytes, the pProperty buffer is.

pProperty

[out] User allocated buffer to contain the property value. To determine the size of the buffer, set pProperty to NULL; use the size to allocate pProperty.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER One of the parameters is an invalid pointer.
TPC_E_UNINITIALIZED_PROPERTY The property has not been set by the context. This may occur if the property is set only in certain circumstances, or if the property is to be set only after an event that has not yet occurred.
TPC_E_INVALID_PROPERTY The recognizer does not support the property.
TPC_E_INSUFFICIENT_BUFFER The pProperty buffer is too small.

Remarks

This function is optional.

You can use the GetContextPropertyValue function to get information that the recognizer is returning to the caller. This enables a customized recognizer to have modes, settings and to return data that is unique to that recognizer.

In the Microsoft® recognizers, calling the GetContextPropertyValue function with the pcbSize parameter set to a value larger than required does not result in an incorrect return value. Instead, the code automatically changes the size to the required value for the current GUID.