次の方法で共有


一般的な呼び出しシーケンス

インク認識エンジンを作成するために実装する必要があるメソッドは、インク対応アプリケーションによって直接ではなく、Tablet PC プラットフォーム API によって呼び出されます。

次の手順は、これらのメソッドを実装するための一般的な呼び出しシーケンスを表します。

  1. DLL が読み込まれます。
  2. HRECOGNIZER ハンドルが作成されます。
  3. HRECOCONTEXT ハンドルが作成されます。
  4. 認識エンジンのオプションとモードは、このコンテキストに対して設定されます。
  5. ストロークがインク データに追加されます。
  6. 入力は終了します。
  7. インクが認識されます。
  8. 認識結果が返されます。
  9. HRECOCONTEXT ハンドルが破棄されます。
  10. HRECOGNIZER ハンドルが破棄されます。

呼び出しシーケンスは、次のコード アウトラインにも示されています。

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);

Recognizer API

Recognition API アーキテクチャの