A Sample Recognizer
This section describes a simple recognizer called SREC that demonstrates some
of the information given in this chapter. The text describes the most
interesting parts of the program and illustrates with code fragments. The complete
source listing for SREC.C resides in the SAMPLES\PEN\SREC subdirectory.
SREC is used by the PENAPP application described in Chapter 7, "A Sample Pen
Application." To see how SREC works, you must create both PENAPP.EXE and
SREC.DLL using the supplied MAKE files, then run PENAPP.
When using the SREC recognizer, PENAPP specifies that a stroke ends when the
pen leaves the tablet. Therefore, SREC recognizes only one stroke at a time.
SREC takes the beginning and ending points of the stroke and calculates the
nearest compass direction of the line formed by these endpoints.
For its
HRC object, SREC creates a structure that contains an
HPENDATA handle to the input data, the module handle returned from
InstallRecognizer, and recognition results. The following
typedef statements define the
HRC and
HRCRESULT objects for SREC. Notice that SREC keeps its
HRCRESULT within the
HRC.
typedef struct // HRCRESULT object
{
DWORD reserved; // Reserve top DWORD
SYG syg; // Recognition results
} HRCRESULTinternal, FAR *LPHRCRESULTinternal;
typedef struct // HRC object
{
DWORD reserved; // Reserve top DWORD
HPENDATA hpendata; // Raw pen data to be recognized
HREC hrec; // Module handle for SREC
HRCRESULTinternal hrcresult; // HRCRESULT structure
} HRCinternal, FAR *LPHRCinternal;
When it finishes recognizing a stroke, SREC fills out a
SYG symbol graph structure. The structure holds one of the symbol values listed
here:
Symbol value
| Direction
|
syvEast
| Right
|
syvSouth
| Down
|
syvWest
| Left
|
syvNorth
| Up
|
syvDot
| Single tap
|
The following sections describe the functions that SREC exports. These
functions appear under the same categories described earlier in this chapter, in the
section "List of Exported Functions." This allows for quick cross-referencing
between a general description of a function and its actual implementation in SREC.
Although defined by the Pen API, the function names below appear in monospace
font rather than bold because the names refer to routines in the SREC.C source
file.
- 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