|
Unboxed Recognition
For recognition of unboxed handwriting that is, writing without visual guides as specified by a GUIDE structure, an application must call the GetResultsHRC function. This function fills an array of HRCRESULT objects, each containing a separate guess by the recognizer. The number of HRCRESULT objects in the array is always less than or equal to the maximum number of
guesses requested through the SetMaxResultsHRC function.
An example will clarify this. Assume an application contains the following
instructions:
#define MAX_GUESS 5 // Maximum number of guesses allowed
.
.
.
SetMaxResultsHRC( hrc1, MAX_GUESS );
The user next writes a word that the recognizer associated with hrc1 guesses to be, in descending order of probability, either "clear," "dear,"
"clean," "dean," or "deer." Though it might have generated even more guesses, the
recognizer is constrained to stop after its fifth guess by the earlier call to SetMaxResultsHRC. In this case, a subsequent call to GetResultsHRC fills an array of up to five HRCRESULT objects, the first HRCRESULT containing the word "clear," the second the word "dear," and so forth.
An HRCRESULT object does not contain a normal ASCII string representation of a guess. This
is not possible since a guess might be made up of a gesture, shape, or other
entity that has no ASCII equivalent. Instead, an HRCRESULT contains a string of symbol values, which are 32-bit numbers type-defined as SYV.
Symbol values can represent geometric shapes, gestures, letters of the
alphabet, Japanese Kanji characters, musical notes, electronic symbols, or any other
symbols defined by the recognizer. The Pen API provides the function SymbolToCharacter to convert the null-terminated symbol string in HRCRESULT to an ASCII string.
The following code continues the example above, illustrating how to retrieve
and display the five guesses returned by the recognizer:
#define MAX_GUESS 5 // Maximum number of guesses allowed
#define MAX_CHAR 50 // Maximum number of characters in
// a single guess
HRCRESULT result[MAX_GUESS]; // Array for recognition result objects
int cGuess;
.
.
.
SetMaxResultsHRC( hrc1, MAX_GUESS );
.
.
.
//
// Get all (non-gesture) guesses available, and if no errors,
// convert to ASCII strings and display them. Note in our
// example the following call returns the value 5 to cGuess.
//
cGuess = GetResultsHRC( hrc1, GRH_NONGESTURE,
(LPHRCRESULT) &result, MAX_GUESS );
if (cGuess > 0)
{
int i, cSyv, cChar;
char szText[MAX_CHAR]; // Buffer for converted text
SYV rgSyv[MAX_CHAR]; // Buffer for symbol string
//
// Loop cGuess (5) times, retrieving each time a symbol string
// representing a different guess. Convert the symbol string
// to a normal ASCII string and display it.
//
// In our example, the five iterations of this loop display the
// words "clear," "dear," "clean," "dean," and "deer."
//
for (i = 0; i < cGuess; i++)
{
cSyv = GetSymbolsHRCRESULT( result[i], 0, rgSyv, MAX_CHAR );
if (cSyv > 0)
{
SymbolToCharacter( (LPSYV) rgSyv, cSyv,
(LPSTR) szText, (LPINT) &cChar );
.
. // After converting to ASCII
. // string, display text
TextOut( hdc, nX, nY, (LPSTR) szText, cChar );
.
.
.
}
DestroyHRCRESULT( result[i] ); // When finished with results,
result[i] = NULL; // destroy HRCRESULT objects
}
}
For another example of how to use the GetResultsHRC function, see "Step 9: PE_RESULT Message" in Chapter 2. If an application
must retrieve an unknown number of symbol values from the recognizer, it should
follow these three steps:
- Call GetSymbolCountHRCRESULT to determine the number of symbol values the recognizer can return.
- Allocate a sufficient buffer for the values.
- Call GetSymbolsHRCRESULT. to copy the symbol values to the buffer.
| Last news from Greatis Software |
 |
|
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 |
|
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 |
|
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 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 offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
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 projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware 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
|