On the Left Hand: How Feature Prioritization Happens How to run Hopper on your application (step-by-step) procedures
Jun 12

Inking on your Windows Mobile Device

While at MEDC I had the chance to present a new addition to the Windows Mobile APIs: WISP Lite


WISP stands for Windows Ink Service Platform and it is the technology for ink recoginition used in other platforms like Tablet PC. In the Windows Mobile 6 SDK Help, it is referred to as Windows Mobile Ink. Even though WISP Lit is just a subset of WISP, it aligns Windows Mobile with the rest of Microsoft. WISP Lite will eventually replace our current rick ink control.


I played with it a little bit, and found out that adding simple ink recognition was not as hard as I expected.


These are the steps that allow you to recognize ink on a given window.


 


1.       Create a Window where input will be recognized as ink. Something like the lines below would do the job. Nothing special about the window, except it is big enough for someone to scribble something.


 


   // 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 an InkOverlay object to that window 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.       Let the user write something on your window.


 


4.       When you are ready to recognize ink: Get the strokes (or dots recognized) and convert the strokes to a string.


 


        g_pInkOverlay->get_Ink( &pInk );


 


        // Get all the strokes in the ink object


        pInk->get_Strokes(&pStrokes);


 


        // Get the recognition result for these strokes


        pStrokes->ToString(&resultString);


 


5.       And voila! resultString now contains the recognized result.


 


 


A few samples that use WISP are shipped with the Windows Mobile 6 SDK.  On my machine they installed to \Program Files\Windows Mobile 6 SDK\Samples\PocketPC\CPP\win32\WISPLite


 


Luis Cabrera


 


 


 

Comments are closed.