|
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.
Related Links
Software for Delphi and C++ Builder developers
Software for Visual Studio .NET developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET
TMS Scripter Studio Pro components for Delphi/C++Builder
More Online Helps
Win32 Programmer's Reference (win32.hlp)
Win32 Multimedia Programmer's Reference (mmedia.hlp)
OLE Programmer's Reference (ole.hlp)
Microsoft Windows Sockets 2 Reference (sock2.hlp)
Microsoft Windows Telephony API (TAPI) Programmer's Reference (tapi.hlp)
Unix Manual Pages
|