ITfContext::TrackProperties メソッド (msctf.h)

複数の範囲に対して複数のプロパティを列挙できる特殊なプロパティを取得します。

構文

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

パラメーター

[in] prgProp

追跡するプロパティを指定するプロパティ識別子の配列を格納します。

[in] cProp

prgProp 配列内のプロパティ識別子の数を格納します。

[in] prgAppProp

追跡するアプリケーション プロパティを指定するアプリケーション プロパティ識別子の配列を格納します。

[in] cAppProp

prgAppProp 配列内のアプリケーション プロパティ識別子の数を格納します。

[out] ppProperty

追跡プロパティを受け取る ITfReadOnlyProperty インターフェイス ポインターへのポインター。

戻り値

このメソッドは、これらの値のいずれかを返すことができます。

説明
S_OK
メソッドは正常に実行されました。
TF_E_DISCONNECTED
コンテキスト オブジェクトがドキュメント スタック上にありません。
E_OUTOFMEMORY
メモリ割り当てエラーが発生しました。
E_INVALIDARG
1 つ以上のパラメーターが無効です。

解説

このメソッドは、複数のプロパティの一貫性のあるプロパティ値を持つ範囲をすばやく識別するために使用されます。 このメソッドは ITfContext::GetProperty メソッドのみを使用して複製できますが、TSF マネージャーはこのタスクをより迅速に実行できます。

このメソッドによって取得される プロパティは、VT_UNKNOWN型です。 このプロパティは、IID_IEnumTfPropertyValueを使用して QueryInterface メソッドを呼び出すことによって、IEnumTfPropertyValue 列挙子を取得するために使用できます。 この列挙子には、 prgProp および prgAppProp で指定されたプロパティ値 が含まれています


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();

要件

   
サポートされている最小のクライアント Windows 2000 Professional [デスクトップ アプリ |UWP アプリ]
サポートされている最小のサーバー Windows 2000 Server [デスクトップ アプリ |UWP アプリ]
対象プラットフォーム Windows
ヘッダー msctf.h
[DLL] Msctf.dll
再頒布可能パッケージ Windows 2000 Professional 上の TSF 1.0

関連項目

IEnumTfPropertyValue

ITfContext

ITfContext::GetProperty

ITfReadOnlyProperty