AddPenInputHRC
As the pen moves, an application continually gets data from the pen driver by
calling
GetPenInput. It then passes the retrieved information to the recognizer via
AddPenInputHRC. This function may be called many times before the user completes the stroke.
Each time,
AddPenInputHRC receives a small subset of points that collectively form a pen stroke.
Along with the subset of points,
AddPenInputHRC receives a
STROKEINFO structure that represents the points in the subset. For example, the member
dwTick contains the starting time for each subset, not the entire stroke. (The
starting time of the first subset of a stroke is also the starting time of the
entire stroke.) Similarly,
cPnt contains the point count only for the current subset.
The following example lets the system take care of accumulating the points. It
calls the
AddPointsPenData API function to add the subset of points to the
HPENDATA block belonging to the
HRC. The code also demonstrates how a recognizer can determine when one stroke
ends and another begins. This allows the recognizer to take some intermediate
steps to facilitate recognition at the end of each stroke. Such intermediate work
can remove some of the burden from
ProcessHRC, improving response time and perhaps accuracy as well.
int WINAPI AddPenInputHRC( HRC hrc, LPPOINT lppnt, LPVOID lpvOem,
UINT oemdatatype, LPSTROKEINFO lpsi )
{
LPHRCinternal lphrc = (LPHRCinternal) hrc; // Pointer to HRC
int iRet = HRCR_OK; // Return code
.
.
.
//
// If state change from down to up (or vice versa), the previous
// stroke has ended and the point data that lppnt points to belongs
// to a new stroke. Take any intermediate action to process the
// just-completed stroke.
//
if (lpsi->wPdk != lphrc->wPdk)
{
.
. // Take intermediate action
.
lphrc->wPdk = lpsi->wPdk // Note new pen state
}
// Accumulate stroke points in internal HPENDATA object
if (!AddPointsPenData( lphrc->hpendata, // HPENDATA handle
lppnt, // Point subset
lpvOem, // OEM data
lpsi )) // Subset STROKEINFO
iRet = HRCR_ERROR;
.
.
.
// Return appropriate error code (HRCR_OK or HRCR_ERROR)
return (iRet);
}
- 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