Condividi tramite


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:

  1. La DLL viene caricata.
  2. Viene creato un handle HRECOGNIZER .
  3. Viene creato un handle HRECOCONTEXT .
  4. Le opzioni e le modalità di riconoscimento sono impostate per questo contesto.
  5. I tratti vengono aggiunti ai dati dell'input penna.
  6. L'input viene terminato.
  7. L'input penna viene riconosciuto.
  8. I risultati del riconoscimento vengono restituiti.
  9. L'handle HRECOCONTEXT viene eliminato.
  10. 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);

API di riconoscimento

Architettura api di riconoscimento