GetPenInput
- 0
Collects data after
StartPenInput has started pen input.
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 structures. The array must consist of at least
cPntMax structures.
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 structures in the array at
lppt. This is the maximum number of points to return and also the maximum number
of OEM items the buffer at
lpvOem can hold.
lpsi
A pointer to a
STROKEINFO structure. This structure receives information about the first point of the
collection of points placed into the array at
lppt. The
cbPnts member contains the packet ID of the first point. All returned points in the
collection have the same tip polarity (that is, up or down) as the first point.
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. There are no more points to retrieve.
|
PCMR_EVENTLOCK
| An event must be taken out of the queue using the Windows functions PeekMessage or GetMessage before any more points can be retrieved using GetPenInput.
|
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, the application then calls the
GetPenInput function frequently to retrieve the actual data arriving from the pen device.
This can be done by responding to hardware events or by continuously polling.
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. A fast loop can potentially process the points before the system can collect
more. In this case, successive calls to
GetPenInput return 0 until the user writes some more. Polling is typically terminated
when
GetPenInput detects and returns a termination condition specified in
StartPenInput.
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
StartPenInput 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
PeekPenInput,
StartPenInput, PDK_
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database