13 Aug 2007

Ink WISP Lite

Dans le SDK WM 6.0 pour les applications natives, vous avez le nouveau composant WISP Lite qui permet à l'utilisateur d'utiliser le stylet pour saisir du texte, ensuite ce composant peut reconnaître le texte saisi.
In WM6.0 SDK for native application, you have the new WISP Lite component allows user to input text with stylus, then WISP Lite can recognize the text.

Voici un exemple de code pour utiliser le WISP Lite:
Here is a code example for using WISP Lite:


  1. // Create the signature window
    hWndInk = CreateWindow( TEXT("static"),
    NULL,
    WS_VISIBLE WS_CHILD WS_BORDER,
    left,
    top + 20,
    215,
    150,
    hWnd,
    NULL,
    hInstance, NULL);

  2. // Attach the inkoverlay to the windows and enable it
    hr = ::CoCreateInstance(CLSID_InkOverlay,
    NULL,
    CLSCTX_INPROC_SERVER,
    IID_IInkOverlay,
    (void **)&g_pInkOverlay);
    ASSERT(SUCCEEDED(hr));

    hr = g_pInkOverlay->put_hWnd((long)hWndInk);
    ASSERT(SUCCEEDED(hr));

    hr = g_pInkOverlay->put_Enabled(VARIANT_TRUE);
    ASSERT(SUCCEEDED(hr));

  3. // Get the strokes and convert to a string
    hr = g_pInkOverlay->get_Ink( &pInk );
    // Get all the strokes in the ink object
    hr = pInk->get_Strokes(&pStrokes);
    // Get the recognition result for these strokes
    hr = pStrokes->get_RecognitionResult(&result);
    // Get the top recognized string
    hr = result->get_TopString(&resultString);

Et c'est fini, resultString contient la chaîne de caractères.
And it is finished, resultString contains the string.


Vous pouvez trouver des exemples plus complets dans le WM6 SDK Refresh :
You can find more examples in the WM6 SDK Refresh directory:

\Program Files\Windows Mobile 6 SDK\Samples\PocketPC\CPP\win32\WISPLite


2 comments:

Anonymous said...

Fabien, check out the managed wrapper OpenNETCF just released called Mobile Ink Library http://blog.markarteaga.com/OpenNETCFMobileInkLibraryForWindowsMobile6.aspx

Fabien Decret said...

Hi Mark,

Thanks for this link...

Fabien