Share via


Método ITfContext::TrackProperties (msctf.h)

Obtiene una propiedad especial que puede enumerar varias propiedades en varios intervalos.

Sintaxis

HRESULT TrackProperties(
  [in]  const GUID          **prgProp,
  [in]  ULONG               cProp,
  [in]  const GUID          **prgAppProp,
  [in]  ULONG               cAppProp,
  [out] ITfReadOnlyProperty **ppProperty
);

Parámetros

[in] prgProp

Contiene una matriz de identificadores de propiedad que especifican las propiedades de las que se va a realizar el seguimiento.

[in] cProp

Contiene el número de identificadores de propiedad en la matriz prgProp .

[in] prgAppProp

Contiene una matriz de identificadores de propiedad de aplicación que especifican las propiedades de la aplicación de las que se va a realizar el seguimiento.

[in] cAppProp

Contiene el número de identificadores de propiedad de aplicación en la matriz prgAppProp .

[out] ppProperty

Puntero a un puntero de interfaz ITfReadOnlyProperty que recibe la propiedad de seguimiento.

Valor devuelto

Este método puede devolver uno de estos valores.

Valor Descripción
S_OK
Método realizado correctamente.
TF_E_DISCONNECTED
El objeto de contexto no está en una pila de documentos.
E_OUTOFMEMORY
Error de asignación de memoria.
E_INVALIDARG
Uno o varios parámetros no son válidos.

Comentarios

Este método se usa para identificar rápidamente intervalos con valores de propiedad coherentes para varias propiedades. Aunque este método podría duplicarse usando solo el método ITfContext::GetProperty , el administrador de TSF puede realizar esta tarea más rápidamente.

La propiedad obtenida por este método es un tipo VT_UNKNOWN. Esta propiedad se puede usar para obtener un enumerador IEnumTfPropertyValue llamando al método QueryInterface con IID_IEnumTfPropertyValue. Este enumerador contiene valores de propiedad especificados por prgProp y prgAppProp.

Ejemplos


const GUID *rgGuids[2] = {  &GUID_PROP_COMPOSING,
                            &GUID_PROP_ATTRIBUTE };
HRESULT hr;
ITfReadOnlyProperty *pTrackProperty;
TF_SELECTION sel;
IEnumTfRanges *pEnumRanges;
ITfRange *pRangeValue;

// Get the tracking property. 
hr = pContext->TrackProperties(NULL, 0, rgGuids, 2, &pTrackProperty);

// Get the selection range. 
hr = pContext->GetSelection(ec, TF_DEFAULT_SELECTION, 1, &sel, &cFetched);

// Use the property from TrackProperties to get an enumeration of the ranges  
// within the selection range that have the same property values. 
hr = pTrackProperty->EnumRanges(ec, &pEnumRanges, sel.range);

// Enumerate the ranges of text. 
while(pEnumRanges->Next(1, &pRangeValue, NULL) == S_OK)
{
    VARIANT varTrackerValue;
    TF_PROPERTYVAL tfPropertyVal;
    IEnumTfPropertyValue *pEnumPropVal;

    // Get the values for this range of text. 
    hr = pTrackProperty->GetValue(ec, pRangeValue, &varTrackerValue);

    // Because pTrackProperties originates from TrackProperties, 
    // varTrackerValue can be identified as a VT_UNKNOWN/IEnumTfPropertyValue. 
    varTrackerValue.punkVal->QueryInterface(    IID_IEnumTfPropertyValue,
                                                (void **)&pEnumPropVal);

    while(pEnumPropVal->Next(1, &tfPropertyVal, NULL) == S_OK)
    {
        BOOL fComposingValue;
        TfGuidAtom gaDispAttrValue;
        
        // Is this the composition property? 
        if (IsEqualGUID(tfPropertyVal.guidId, GUID_PROP_COMPOSING))
        {
            fComposingValue = (BOOL)tfPropertyVal.varValue.lVal;
        }
        // Or is this the attribute property? 
        else if (IsEqualGUID(tfPropertyVal.guidId, GUID_PROP_ATTRIBUTE))
        {
            gaDispAttrValue = (TfGuidAtom)tfPropertyVal.varValue.lVal;
        }
        
        // Clear the property. 
        VariantClear(&tfPropertyVal.varValue);
    }

    // Clear the tracker property. 
    VariantClear(&varTrackerValue);

    // Release the property enumerator. 
    pEnumPropVal->Release();

    // Release the range. 
    pRangeValue->Release();
}

// Release the selection range. 
sel.range->Release();

Requisitos

   
Cliente mínimo compatible Windows 2000 Professional [aplicaciones de escritorio | Aplicaciones para UWP]
Servidor mínimo compatible Windows 2000 Server [aplicaciones de escritorio | Aplicaciones para UWP]
Plataforma de destino Windows
Encabezado msctf.h
Archivo DLL Msctf.dll
Redistribuible TSF 1.0 en Windows 2000 Professional

Consulte también

IEnumTfPropertyValue

ITfContext

ITfContext::GetProperty

ITfReadOnlyProperty