Nuo Yan

Problem Solved

Recent Posts

Tags

News


  • Follow me on twitter: @nuoyan
    Make a donation to this Blog by PayPal. Thanks!






    Nuo is currently a Software Development Engineer in a Seattle-based software company.




    Locations of visitors to this page

    The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my school or employer. It is solely my opinion. Inappropriate comments will be deleted at the authors discretion. All code samples are provided "AS IS" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.


Community

Email Notifications

Archives

August 2007 - Posts

Windows Mobile Ink: The Correct Way of Getting Recognition Results

 

Windows Mobile Ink APIs are new in Windows Mobile 6 SDK. I guess they are trying to replace the old RichInk APIs.

The way of using Windows Mobile Ink is not complex. The basic idea is to have a IInkOverlay object as an ink collector; an IInkDisp object as a container of strokes data; an IInkStrokes object as a collection of IInkStrokeDisp object. The IInkOverlay object collects the ink data and put them in the IInkDisp object. Then the IInkDisp object put the strokes to the IInkStrokes object.

When the strokes data are in the IInkStrokes object, it's time to get the best recognition result. Currently there are two ways of doing that. One is to directly use the ToString() method to get the best recognition result; the other is to create an IInkRecognitionResult object and use get_RecognitionResult property to get the recognition result set from the IInkStrokes object, then use get_TopString() property to get the best fit result and put it in the BSTR. 

 /**

* pInkStrokes is the IInkStrokes object. 

* pInkRecognitionResult is the IInkRecognitinoResult object.  

* StringRecognitionResult is the BSTR.

**/

//Get the best recognition result to the IInkRecognitionResult object

pInkStrokes->get_RecognitionResult(&pInkRecognitionResult);

//Get the best recognition result to the BSTR

pInkRecognitionResult->get_TopString(&StringRecognitionResult);

 

The first way, using ToString(), seems to be much easier than the second way which is to use IInkRecognitionResult object; However, ToString() is not recommended to be used in this case. I've ever mistakenly used ToString() in this case and had some strange exceptions raised (i.e. WinCE501bException) when my application is not used properly. As the result the correct way of getting ink recognition results is to use IInkRecognitionResult object and its properties.

Posted: Sun, Aug 5 2007 1:30 by Nuo Yan | with 6 comment(s) |
Filed under: