Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The methods you must implement to create an ink recognizer are called by the Tablet PC Platform APIs and not directly by an ink-enabled application.
The following steps represent a typical calling sequence for the implementation of these methods:
- The DLL is loaded.
- An HRECOGNIZER handle is created.
- An HRECOCONTEXT handle is created.
- Recognizer options and modes are set for this context.
- Strokes are added to the ink data.
- Input is ended.
- The ink is recognized.
- The recognition results are returned.
- The HRECOCONTEXT handle is destroyed.
- The HRECOGNIZER handle is destroyed.
The calling sequence is also illustrated in the following code outline:
CreateRecognizer(CLSID, &hrec);
while (more pieces of ink to recognize ... )
{
// Create a context, once per piece of ink to be recognized
hrc = CreateContext(hrec, &hrc);
// Functions to set up options and modes for this context
SetGuide(hrc, pGuide, 0);
SetFactoid(hrc, 5, PHONE); // only if in application with forms
SetFlags(hrc, RECOFLAG_WORDMODE); // rare, only if wanting word mode, no out-of-dictionary, or single segmentation
SetWordList(hrc, hwl);
// Adding all the strokes in this piece of ink
while (more strokes ... )
{
AddStroke(hrc, NULL, 800, pPacket, pXForm); // one call per stroke
}
EndInkInput(hrc);
// This gets the ink recognized
Process(hrc);
// If this is a simple application, it calls this for a simple answer
GetBestResultString(hrc, length, buffer);
// If this is a complex application, it calls this for a complete answer
GetLatticePtr(hrc, &pLattice);
// Destroy the context
DestroyContext(hrc);
}
// Called just before the application shuts down
DestroyRecognizer(hrec);
Related topics