IRealTimeStylus::GetTabletFromTabletContextId 方法 (rtscom.h)

检索指定平板电脑上下文的 IInkTablet 接口

语法

HRESULT GetTabletFromTabletContextId(
  [in]          TABLET_CONTEXT_ID tcid,
  [out, retval] IInkTablet        **ppiTablet
);

parameters

[in] tcid

指定平板电脑上下文的唯一标识符。

[out, retval] ppiTablet

指向由平板电脑上下文标识符指定的数字化器对象的指针。

返回值

有关返回值的说明,请参阅 RealTimeStylus 类和接口

注解

平板电脑上下文标识符特定于 RealTimeStylus 类 对象。 两个 RealTimeStylus 类 对象对于同一平板电脑对象可以具有不同的上下文标识符。 仅当 启用了 RealTimeStylus 类 对象时,平板电脑上下文标识符才有效。 如果 禁用 RealTimeStylus Class 对象,然后重新启用,则每个平板电脑对象的平板电脑上下文标识符的值可能与首次启用 RealTimeStylus Class 对象时的值不同。

即使 IRealTimeStylus::Enabled 属性 返回 false ,只要 IStylusPlugin::RealTimeStylusDisabled 方法 尚未完成队列中的数据处理,也可以调用此方法。 可以调用此方法,直到最后一个异步插件收到 IStylusPlugin::RealTimeStylusDisabled 方法

示例

以下 C++ 示例代码使用平板电脑上下文标识符获取指向 IInkTablet Interface 对象的指针。

TABLET_CONTEXT_ID* pTcids = NULL;
TABLET_CONTEXT_ID tcid = 0;
ULONG ulTcidCount = 0;
IInkTablet* pInkTablet = NULL;

if (SUCCEEDED(g_pRealTimeStylus->GetAllTabletContextIds(&ulTcidCount, &pTcids)))
{
    TRACE("Got the tablet context ID array.\n");

    // Loop through all the tablets on the system
    for (ULONG i = 0; i < ulTcidCount; i++)
    {
        // Get the tablet from the context ID
        if (SUCCEEDED(g_pRealTimeStylus->GetTabletFromTabletContextId(pTcids[i], &pInkTablet)))
        {
            // Display the name of the tablet in debug output
            BSTR bstrName;
            if (SUCCEEDED(pInkTablet->get_Name(&bstrName)))
            {
                TRACE("The name of tablet %d is %s.\n", i, bstrName);
            }
        }
    }

    // Get the context ID from the tablet
    if (SUCCEEDED(g_pRealTimeStylus->GetTabletContextIdFromTablet(pInkTablet, &tcid)))
    {
        TRACE("The context ID of the tablet is %d\n", tcid);
    }
}

要求

   
最低受支持的客户端 Windows XP Tablet PC Edition [仅限桌面应用]
最低受支持的服务器 无受支持的版本
目标平台 Windows
标头 rtscom.h
DLL RTSCom.dll

请参阅

IRealTimeStylus

IRealTimeStylus::GetTabletContextIdFromTablet 方法

RealTimeStylus 类