Sequenza di chiamate tipica
I metodi che è necessario implementare per creare un riconoscimento penna vengono chiamati dalle API della piattaforma Tablet PC e non direttamente da un'applicazione abilitata per l'input penna.
I passaggi seguenti rappresentano una tipica sequenza chiamante per l'implementazione di questi metodi:
- La DLL viene caricata.
- Viene creato un handle HRECOGNIZER .
- Viene creato un handle HRECOCONTEXT .
- Le opzioni e le modalità di riconoscimento sono impostate per questo contesto.
- I tratti vengono aggiunti ai dati dell'input penna.
- L'input viene terminato.
- L'input penna viene riconosciuto.
- I risultati del riconoscimento vengono restituiti.
- L'handle HRECOCONTEXT viene eliminato.
- L'handle HRECOGNIZER viene distrutto.
La sequenza chiamante è illustrata anche nella struttura del codice seguente:
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);
Argomenti correlati