IRealTimeStylus::GetTabletContextIdFromTablet method (rtscom.h)

Retrieves the TabletContextId property that is associated with a given tablet digitizer object.


HRESULT GetTabletContextIdFromTablet(
  IInkTablet        *piTablet,



Specifies the tablet object associated with a digitizer for which to get the unique identifier for the tablet context.


The unique identifier for the tablet context.

Return value

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


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

This method can be called even if the RealTimeStylus Class object is not enabled as long as the RealTimeStylus Class has not finished processing data in the queue. This method can be called until the last asynchronous plug-in receives IStylusPlugin::RealTimeStylusDisabled Method.


The following C++ example code gets a pointer to the IInkTablet object and uses that to get the tablet context identifier. Then it displays the names of all the tablets attached to the system in the debug output window.

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


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::GetTabletFromTabletContextId Method

RealTimeStylus Class