漫談WinCE的手寫識(shí)別技術(shù)(二)
//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)
#define HWXGETRESULTS(hrc,cAlt,iFirst,cBoxRes,rgBoxResults) HwxGetResults(hrc,cAlt,iFirst,cBoxRes,rgBoxResults)
#define HWXDESTROY(hrc) HwxDestroy(hrc)
#define HWXENDINPUT(hrc) HwxEndInput(hrc)
#endif //RECOGNIZE_FUNCTION_FROM_LIB
};
//============================================================================================
#endif // !defined RECOGNIZER_H
//////////////////////////////////////////////////////////////////////
// Recognizer.cpp: implementation of the CRecognizer class. //
//////////////////////////////////////////////////////////////////////
#include stdafx.h
#include Recognizer.h
//----------------------------------------------------------------
//Macro define
//The default value of hwxGuide
#define DEFAULT_HWXGUIDE_CHORZBOX 1
評(píng)論