Condividi tramite


Sequenza di chiamata tipica

I metodi che è necessario implementare per creare un riconoscimento input penna vengono chiamati dalle API Tablet PC Platform e non direttamente da un'applicazione abilitata per l'input penna.

I passaggi seguenti rappresentano una sequenza di chiamata tipica per l'implementazione di questi metodi:

  1. La DLL viene caricata.
  2. Viene creato un handle di HRECOGNIZER.
  3. Viene creato un handle di HRECOCONTEXT.
  4. Le opzioni e le modalità di riconoscimento sono impostate per questo contesto.
  5. I tratti vengono aggiunti ai dati input penna.
  6. L'input è terminato.
  7. L'input penna viene riconosciuto.
  8. Vengono restituiti i risultati del riconoscimento.
  9. L'handle di HRECOCONTEXT viene eliminato definitivamente.
  10. L'handle di HRECOGNIZER viene eliminato definitivamente.

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 dell'API riconoscimento