Metode IStylusPlugin::InAirPackets (rtscom.h)
Memberi tahu objek yang mengimplementasikan plug-in bahwa stylus bergerak di atas digitizer.
Sintaks
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
);
Parameter
[in] piRtsSrc
Objek Kelas RealTimeStylus (RTS) yang mengirim pemberitahuan.
[in] pStylusInfo
Struktur Struktur StylusInfo yang berisi informasi tentang RTS yang terkait dengan stylus.
[in] cPktCount
Jumlah properti per paket data.
[in] cPktBuffLength
Panjangnya, dalam byte, dari buffer yang diacu oleh pPackets. Memori yang ditempati oleh setiap paket adalah (cPktBuffLength / cPktCount). Nilai yang valid adalah 0 hingga 0x7FFF, inklusif.
[in] pPackets
Penunjuk ke awal data paket. Sampel ini bersifat baca-saja.
[in, out] pcInOutPkts
Jumlah LONG dalam ppInOutPkt.
[in, out] ppInOutPkts
Penunjuk ke array paket data stylus yang dimodifikasi. Plug-in dapat menggunakan parameter ini untuk memberi umpan data paket yang dimodifikasi ke paket hilir. Untuk nilai selain NULL, RTS akan mengirim data ini ke plug-in dengan menggunakan parameter pPacket .
Nilai kembali
Untuk deskripsi nilai pengembalian, lihat Kelas dan Antarmuka - Analisis Tinta.
Keterangan
Metode ini dipanggil ketika paket data dibuat oleh stylus ketika berada dalam rentang tetapi bergerak di atas digitizer dan tidak menyentuh digitizer. Anda dapat mengembalikan array paket yang dimodifikasi dengan menggunakan parameter ppInOutPkt . Buat buffer dan arahkan ppInOutPkts ke dalamnya. Hanya satu paket yang dapat hadir di lokasi tersebut.
- Ketika pemberitahuan mengharuskan plug-in memperoleh informasi lebih lanjut tentang digitizer tertentu dari mana pemberitahuan berasal.
- Saat Anda memasukkan pemberitahuan kustom tambahan melalui sistem.
Contoh
Contoh kode C++ berikut mengimplementasikan metode Metode IStylusPlugin::P ackets yang memodifikasi data X,Y untuk menahan paket menjadi persegi panjang. Kode yang sama dapat diterapkan ke implementasi Metode 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;
}
Persyaratan
Persyaratan | Nilai |
---|---|
Klien minimum yang didukung | Windows XP Tablet PC Edition [hanya aplikasi desktop] |
Server minimum yang didukung | Tidak ada yang didukung |
Target Platform | Windows |
Header | rtscom.h |
DLL | RTSCom.dll |
Lihat juga
Metode IStylusPlugin::StylusDown