GetPenInput
2.0
Collects data
after StartPenInput
int GetPenInput( HPCM hpcm, LPPOINT lppt,
LPVOID lpvOem, UINT fuOemFlags, UINT cPntMax,
LPSTROKEINFO lpsi )
Parameters
hpcm
Handle to the
current collection. This is the return value from StartPenInput.
lppt
Address of an
array of POINT
lpvOem
The address
of a buffer of OEM data associated with each point. This parameter can be NULL
if the application does not require OEM data.
fuOemFlags
Flags
specifying which OEM data to retrieve. If this parameter is NULL, all OEM data
provided by the tablet is returned in the order specified by the rgoempeninfo
array in PENINFO
These flags have an implicit order. For example, if pressure and barrel
rotation are specified, cPntMax pairs of these data are returned, in the
order [pressure, rotation], [pressure, rotation], and so on.
Constant |
Description |
PHW_PRESSURE |
Retrieve
pressure data. |
PHW_HEIGHT |
Retrieve
height data. |
PHW_ANGLEXY |
Retrieve
data pertaining to the x- and y-coordinates. |
PHW_ANGLEZ |
Retrieve
data pertaining to the z-coordinates. |
PHW_BARRELROTATION |
Retrieve
barrel-rotation data. |
PHW_OEMSPECIFIC |
Retrieve
OEM-specific data. |
PHW_PDK |
Retrieve
per-point PDK_ information in OEM data. |
cPntMax
The number of
POINT
lpsi
A pointer to
a STROKEINFO
Return Value
Returns 0 if
there are no points available. If the return value is positive, the value is
the number of points copied to the lppt (and, optionally, lpvOem)
buffers. Otherwise, the return value is one of the following:
Constant |
Description |
PCMR_APPTERMINATED |
Input has
already terminated because the application called StopPenInput |
PCMR_EVENTLOCK |
An event
must be taken out of the queue using the Windows functions PeekMessage |
PCMR_INVALIDCOLLECTION |
The hpcm
handle is invalid because the calling application did not start input with StartPenInput |
PCMR_TERMTIMEOUT |
Input has
already terminated because the specified time-out period has elapsed. |
PCMR_TERMRANGE |
Input has
already terminated because the pen has left the range of the tablet s zone of
sensitivity. |
PCMR_TERMPENUP |
Input has
already terminated because the pen was lifted from the tablet. |
PCMR_TERMEX |
Input has
already terminated because the pen went down in a specified exclusion
rectangle or region. |
PCMR_TERMBOUND |
Input has
already terminated because the pen went down outside a specified bounding
rectangle or region. |
Comments
Once an
application initiates pen-input collection by calling StartPenInput
In the
polling model, the application repeatedly calls GetPenInput to get data.
It is important for the application to yield periodically; for example, by
calling PeekMessage
In the event
model, the application calls GetPenInput on receipt of a WM_PENEVENT
message. All points up to this event are returned to the caller. An application
can retrieve all available data in a short loop, until GetPenInput
returns PCMR_EVENTLOCK. The application then falls out of the loop and exits
the window procedure. The process begins again when the window procedure is
called in response to another WM_PENEVENT message in the application s message
queue.
If lpvOem
is not NULL, the buffer must be large enough to hold cPntMax OEM data
packets. The size of each packet is the width specified in the cbOemData
member of the PENINFO
structure, plus sizeof( UINT ) if PDK_ values are required.
Example
The following
code example gathers more pen input for use by the recognizer. Assume the
application has already called StartPenInput1AOCU6 and is using the messaging collection
model.
POINT rgPnt[cbBuffer];
STROKEINFO si;
// ... in WM_PENEVENT message handler:
switch (wParam)
{
.
.
.
case PE_PENUP:
case PE_PENMOVE:
case PE_TERMINATING:
// Get all
the points collected since the last message
while (
(iRet = GetPenInput( hpcm, rgPnt, NULL, 0,
cbBuffer, &si) ) > 0)
{
//
Add pen data to recognition context and def process
AddPenInputHRC(
vhrc, rgPnt, NULL, 0, &si );
ProcessHRC(
vhrc, PH_DEFAULT );
}
break;
See Also