IRealTimeStylus::GetTabletFromTabletContextId method (rtscom.h)

Retrieves an IInkTablet Interface for a specified tablet context.

Syntax

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

Parameters

[in] tcid

Specifies the unique identifier for the tablet context.

[out, retval] ppiTablet

A pointer to the digitizer object specified by the tablet context identifier.

Return value

For a description of the return values, see RealTimeStylus Classes and Interfaces.

Remarks

A tablet context identifier is specific to a RealTimeStylus Class object. Two RealTimeStylus Class objects can have different context identifiers for the same tablet object. A tablet context identifier is only valid while a RealTimeStylus Class object is enabled. If a RealTimeStylus Class object is disabled and then re-enabled, the tablet context identifier for each tablet object may have a different value than when the RealTimeStylus Class object was first enabled.

This method can be called even if IRealTimeStylus::Enabled Property returns false as long as the IStylusPlugin::RealTimeStylusDisabled Method has not finished processing data in the queue. This method can be called until the last asynchronous plug-in receives IStylusPlugin::RealTimeStylusDisabled Method.

Examples

The following C++ example code uses the tablet context identifier to get a pointer to the IInkTablet Interface object.

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

Requirements

Requirement Value
Minimum supported client Windows XP Tablet PC Edition [desktop apps only]
Minimum supported server None supported
Target Platform Windows
Header rtscom.h
DLL RTSCom.dll

See also

IRealTimeStylus

IRealTimeStylus::GetTabletContextIdFromTablet Method

RealTimeStylus Class