共用方式為


IStylusPlugin::InAirPackets 方法 (rtscom.h)

通知實作外掛程式的物件,手寫筆在數位板上方移動。

語法

HRESULT InAirPackets(
  [in]      IRealTimeStylus  *piRtsSrc,
  [in]      const StylusInfo *pStylusInfo,
  [in]      ULONG            cPktCount,
  [in]      ULONG            cPktBuffLength,
  [in]      LONG             *pPackets,
  [in, out] ULONG            *pcInOutPkts,
  [in, out] LONG             **ppInOutPkts
);

參數

[in] piRtsSrc

傳送通知的 RealTimeStylus 類別 (RTS) 物件。

[in] pStylusInfo

StylusInfo 結構結構,其中包含與手寫筆相關聯的 RTS 相關信息。

[in] cPktCount

每個數據封包的屬性數目。

[in] cPktBuffLength

pPackets 所指向之緩衝區的長度,以位元組為單位。 每個封包所佔用的記憶體會 (cPktBuffLength / cPktCount) 。 有效值為 0 到 0x7FFF,包含。

[in] pPackets

封包數據開頭的指標。 此範例僅供讀取。

[in, out] pcInOutPkts

ppInOutPkt 中的LONG數目。

[in, out] ppInOutPkts

已修改手寫筆數據封包陣列的指標。 外掛程式可以使用此參數,將修改過的封包數據饋送至下游封包。 若為 NULL 以外的值,RTS 會使用 pPacket 參數,將此數據向下傳送至外掛程式。

傳回值

如需傳回值的描述,請參閱 類別和介面 - 筆跡分析

備註

當手寫筆在範圍中,但移動在數位板上方且未觸碰數位板時,就會呼叫此方法。 您可以使用 ppInOutPkt 參數傳回已修改封包的陣列。 建立緩衝區並將 ppInOutPkts 指向它。 該位置只能有一個封包。

注意 可以刪除 IStylusPlugin::P ackets 方法和IStylusPlugin::InAirPackets 方法 方法所使用的封包。
 
手寫筆外掛程式可能會與單一 RTS 或許多項目相關聯。 在下列情況下,請使用 piRtsSrc 參數:
  • 當通知要求外掛程式取得通知來源特定數位板的詳細資訊時。
  • 當您透過系統輸入其他自訂通知時。
封包可以配套以取得更有效率的數據傳輸。 因此,每個封包不需要呼叫一次外掛程式。 IStylusPlugin::InAirPackets 方法和IStylusPlugin::P ackets 方法 可以傳送一或多個封包。

範例

下列 C++ 程式代碼範例會實作 IStylusPlugin::P ackets 方法 ,以修改 X,Y 數據以將封包重新定型至矩形。 相同的程式代碼可以套用至 IStylusPlugin::InAirPackets 方法的實作。

STDMETHODIMP CPacketModifier::Packets( 
            /* [in] */ IRealTimeStylus *piRtsSrc,
            /* [in] */ const StylusInfo *pStylusInfo,
            /* [in] */ ULONG cPktCount,
            /* [in] */ ULONG cPktBuffLength,
            /* [size_is][in] */ LONG *pPackets,
            /* [out][in] */ ULONG *pcInOutPkts,
            /* [out][in] */ LONG **ppInOutPkts)
{
	BOOL fModified = FALSE;                             // Did we change the packet data?
	ULONG cPropertyCount = cPktBuffLength/cPktCount;    // # of properties in a packet
	ULONG iOtherProps = 0;                              // Properties other than X and Y

	// Allocate memory for modified packets
	LONG* pTempOutPkts = (LONG*)CoTaskMemAlloc(sizeof(ULONG)*cPktBuffLength);

	// For each packet in the packet data, check whether
	// its X,Y values fall outside of the specified rectangle.  
	// If so, replace them with the nearest point that still
	// falls within the rectangle.
	for (ULONG i = 0; i < cPktCount; i += cPropertyCount)
	{
		// Packet data always has X followed by Y 
		// followed by the rest
		LONG x = pPackets[i];
		LONG y = pPackets[i+1];

		// Constrain points to the input rectangle
		x = (x < m_filterRect.left ? m_filterRect.left : x);
		x = (x > m_filterRect.right ? m_filterRect.right : x);
		y = (y < m_filterRect.top ? m_filterRect.top : y);
		y = (y > m_filterRect.bottom ? m_filterRect.bottom : y);

		// If necessary, modify the X,Y packet data
		if ((x != pPackets[i]) || (y != pPackets[i+1]))
		{
			pTempOutPkts[i] = x;
			pTempOutPkts[i+1] = y;
			iOtherProps = i+2;
		
			// Copy the properties that we haven't modified
			while (iOtherProps < (i + cPropertyCount))
			{
				pTempOutPkts[iOtherProps] = pPackets[iOtherProps++];
			}

			fModified = TRUE;
		}
	}

	if (fModified)
	{
		// Set the [out] pointer to the 
		// memory we allocated and updated
		*ppInOutPkts = pTempOutPkts;
		*pcInOutPkts = cPktCount;
	}
	else
	{
		// Nothing modified, release the memory we allocated
		CoTaskMemFree(pTempOutPkts);
	}

	return S_OK;
}

規格需求

需求
最低支援的用戶端 Windows XP Tablet PC Edition [僅限傳統型應用程式]
最低支援的伺服器 都不支援
目標平台 Windows
標頭 rtscom.h
Dll RTSCom.dll

另請參閱

IStylusAsyncPlugin

IStylusPlugin 介面

IStylusPlugin::StylusDown 方法

IStylusPlugin::StylusUp 方法

IStylusSyncPlugin