Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Notifies the implementing plug-in that the stylus is entering the detection range of the digitizer.
Syntax
HRESULT StylusInRange(
  [in] IRealTimeStylus   *piRtsSrc,
  [in] TABLET_CONTEXT_ID tcid,
  [in] STYLUS_ID         sid
);
Parameters
[in] piRtsSrc
The RealTimeStylus Class object that sent the notification.
[in] tcid
Tablet context identifier.
[in] sid
Stylus identifier.
Return value
For a description of return values, see RealTimeStylus Classes and Interfaces.
Remarks
The stylus is in range of the digitizer. This is a good place to check if the stylus is inverted and if so, switch to eraser mode.
Examples
The following C++ example implements a IStylusPlugin::StylusInRange Method method that gets the status of all the buttons on a stylus and reports them to the debug window using the TRACE macro.
STDMETHODIMP CPacketModifier::StylusInRange( 
            /* [in] */ IRealTimeStylus *piRtsSrc,
            /* [in] */ TABLET_CONTEXT_ID tcid,
            /* [in] */ STYLUS_ID sid)
{
    IInkCursor* pInkCursor;
	HRESULT hr = piRtsSrc->GetStylusForId(sid, &pInkCursor);
	if (SUCCEEDED(hr))
	{
		IInkCursorButtons* pInkCursorButtons;
		hr = pInkCursor->get_Buttons(&pInkCursorButtons);
		if (SUCCEEDED(hr))
		{
			LONG lButtonCount;
			pInkCursorButtons->get_Count(&lButtonCount);
			if (SUCCEEDED(hr))
			{
				IInkCursorButton* pInkCursorButton;
				VARIANT index;
				VariantInit(&index);
				index.vt = VT_I4;
				for (index.intVal = 0; index.intVal < lButtonCount; index.intVal++)
				{
					hr = pInkCursorButtons->Item(index, &pInkCursorButton);
					if (SUCCEEDED(hr))
					{
						InkCursorButtonState currentState;
						hr = pInkCursorButton->get_State(¤tState);
						if (SUCCEEDED(hr))
						{
							switch(currentState)
							{
								case ICBS_Unavailable:
									TRACE("ICBS_Unavailable\n");
									break;
								case ICBS_Up:
									TRACE("ICBS_Up\n");
									break;
								case ICBS_Down:
									TRACE("ICBS_Down\n");
									break;
								default:
									TRACE("Cursor button state unknown.\n");
									break;
							}
						}
					}
				}
				VariantClear(&index);
			}
		}
	}
	return hr;
}
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 |