WindowsCE的手写识别技术2

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

漫谈WinCE的手写识别技术(二)

//========================================================================

//TITLE:

// 漫谈WinCE的手写识别技术(二)

//AUTHOR:

// norains

//DATE:

// Thursday 25-January -2007

//Environment:

// EVC4.0 + Standard SDK

//========================================================================

在第一章的时候,已经介绍了识别的一般性过程,对于实际运用来说,是完全可行的;但从便利性角度出发,却不免显得烦琐:每次输入笔画都需留意点阵是否屏幕坐标系,每次读取返回的字符总要分配内存然后获取等等,诸如总总,代码写一次还好,如果多处运用多次编写多方维护,实在不是一件快乐的事情.

而我,最讨厌做复杂又要花费脑筋的东东;所以,为了让自己感觉得写代码是一件快乐的事情,自己又很高兴地将识别过程封装为一个类.至于是否达到简便的效果,不敢祈求大家苟同,只愿自己舒坦即可.

/**///////////////////////////////////////////////////////////////////////

// Recognizer.h: interface for the CRecognizer class. //

/**///////////////////////////////////////////////////////////////////////

#ifndef RECOGNIZER_H

#define RECOGNIZER_H

//===========================================================================

//Include file

#include "recog.h"

//=====================================================================================

//Choose the build type for the recognizing function

//--------------------------------------------------------------------------

#define RECOGNIZE_FUNCTION_FROM_DLL

//#define RECOGNIZE_FUNCTION_FROM_LIB

#ifndef RECOGNIZE_FUNCTION_FROM_LIB

#ifndef RECOGNIZE_FUNCTION_FROM_DLL

#define RECOGNIZE_FUNCTION_FROM_DLL

#endif

#endif

#ifdef RECOGNIZE_FUNCTION_FROM_DLL

#define RECOGNIZE_DLL_PATH TEXT("\WINDOWS\hwxcht.dll")

#endif

//=====================================================================================

//-----------------------------------------------------------------------------------

//The data type

//The scale type for the coordinate

enum ScaleType

...{

SCALE_APPWND,

SCALE_SCREEN

};

//------------------------------------------------------------------------------

class CRecognizer

...{

public:

BOOL InputStroke(POINT *lpPnt, int iCount, ScaleType scale);

CRecognizer();

virtual ~CRecognizer();

int GetCharacter(WCHAR *pWchar, int iCount);

BOOL EndRecognize();

BOOL BeginRecognize();

BOOL Initialize(HWND hWnd,const RECT *prcWnd,ScaleType scale);

protected:

HRC m_hrc;

HWXGUIDE m_hwxGuide;

HWND m_hWndRecog;

ALC m_alc;

#ifdef RECOGNIZE_FUNCTION_FROM_DLL

typedef BOOL (WINAPI *DLL_HWXCONFIG)(void);

typedef HRC (WINAPI *DLL_HWXCREATE)(HRC = NULL);

typedef BOOL (WINAPI *DLL_HWXSETGUIDE)(HRC ,HWXGUIDE*);

typedef BOOL (WINAPI *DLL_HWXALCVALID)(HRC,ALC);

typedef BOOL (WINAPI *DLL_HWXALCPRIORITY)(HRC,ALC);

typedef BOOL (WINAPI *DLL_HWXSETCONTEXT)(HRC,WCHAR);

typedef BOOL (WINAPI *DLL_HWXINPUT)(HRC,POINT*,UINT, DWORD);

typedef BOOL (WINAPI *DLL_HWXENDINPUT)(HRC);

typedef BOOL (WINAPI *DLL_HWXPROCESS)(HRC);

typedef INT (WINAPI *DLL_HWXRESULTSAVAILABLE)(HRC);

typedef INT32 (WINAPI *DLL_HWXGETRESULTS)(HRC, UINT, UINT, UINT, HWXRESULTS*);

typedef BOOL (WINAPI *DLL_HWXDESTROY)(HRC);

DLL_HWXCONFIG HWXCONFIG;

DLL_HWXCREATE HWXCREATE;

DLL_HWXSETGUIDE HWXSETGUIDE;

DLL_HWXALCVALID HWXALCVALID;

DLL_HWXALCPRIORITY HWXALCPRIORITY;

DLL_HWXSETCONTEXT HWXSETCONTEXT;

DLL_HWXINPUT HWXINPUT;

DLL_HWXPROCESS HWXPROCESS;

DLL_HWXRESULTSAVAILABLE HWXRESULTSAVAILABLE;

DLL_HWXGETRESULTS HWXGETRESULTS;

DLL_HWXDESTROY HWXDESTROY;

DLL_HWXENDINPUT HWXENDINPUT;

#endif //RECOGNIZE_FUNCTION_FROM_DLL

#ifdef RECOGNIZE_FUNCTION_FROM_LIB

#define HWXCONFIG(void) HwxConfig(void)

#define HWXCREATE(hrc) HwxCreate(hrc)

#define HWXSETGUIDE(hrc,lpGuide) HwxSetGuide(hrc,lpGuide)

#define HWXALCVALID(hrc,alc) HwxALCValid(hrc,alc)

#define HWXALCPRIORITY(hrc,alc) HwxALCPriority(hrc,alc)

#define HWXSETCONTEXT(hrc,wContext) HwxSetContext(hrc,wContext) #define HWXINPUT(hrc,lppnt,upoints,timestamp) HwxInput(hrc,lppnt,upoints,timestamp) #define HWXPROCESS(hrc) HwxProcess(hrc)

#define HWXRESULTSAVAILABLE(hrc) HwxResultsAvailable(hrc)

相关文档
最新文档