Home   Index   About
Ultimate Pack


Custom Search
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.


Last news from Greatis Software

Nostalgia .Net     Nostalgia .Net     .Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes.  More »

Recommended software for developers

Ultimate Pack for Delphi and C++ Builder     Ultimate Pack     Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price.  More »

Form Designer .Net     Form Designer .Net     Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro!  More »

Print Suite .Net     Print Suite .Net     Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available  More »

Gradient Controls .Net     Gradient Controls .Net     Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available  More »

iGrid     Greatis iGrid     iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors.  More »


All the contacts and projects

Dmitry Vasiliev (just.dmitry)

Related Links

Software for Visual Studio .NET developers
Software for Delphi and C++ Builder developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET

More Online Helps

Win32 Programmer's Reference
Win32 Multimedia Programmer's Reference
OLE Programmer's Reference
Microsoft Windows Pen API Programmer's Reference
Microsoft Windows Sockets 2 Reference
Microsoft Windows Telephony API (TAPI) Programmer's Reference
Unix Manual Pages

Free Tech Secrets ;) Copyright © 2008-2012 Free Tech Secrets ;) greatis just4fun network just4fun