漫谈WinCE的手写识别技术(二)
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 #define DEFAULT_HWXGUIDE_CVERTBOX 1 #define DEFAULT_HWXGUIDE_CXOFFSET 1 #define DEFAULT_HWXGUIDE_CYOFFSET 1 //The default value of ALC #define DEFAULT_ALC ALC_KANJI_ALL //-------------------------------------------------------------------- // Construction/Destruction CRecognizer::CRecognizer() { m_alc = NULL; m_hrc = NULL; m_hWndRecog = NULL; memset(m_hwxGuide,0,sizeof(m_hwxGuide)); } CRecognizer::~CRecognizer() { } //----------------------------------------------------------------------- //Descriptiong: // Initialize the recognizer // //Parameter: // hWnd: [in] The handle of window to be recognized // rcWnd: [in] The window area to be recognized // scale: [in] The scale base of prcWnd point //----------------------------------------------------------------------- BOOL CRecognizer::Initialize(HWND hWnd,const RECT *prcWnd,ScaleType scale) { m_hWndRecog = hWnd; m_alc = DEFAULT_ALC; RECT rcWnd = {0}; switch(scale) { case SCALE_APPWND: { rcWnd = *prcWnd; rcWnd.left *= 4; rcWnd.right *= 4; rcWnd.top *= 4; rcWnd.bottom *= 4; MapWindowPoints(hWnd,HWND_DESKTOP,(LPPOINT)(rcWnd),(sizeof(RECT)/sizeof(POINT))); break; } case SCALE_SCREEN: { rcWnd = *prcWnd; break; } } m_hwxGuide.cHorzBox = DEFAULT_HWXGUIDE_CHORZBOX; m_hwxGuide.cVertBox = DEFAULT_HWXGUIDE_CVERTBOX; m_hwxGuide.xOrigin = rcWnd.left; m_hwxGuide.yOrigin = rcWnd.top; m_hwxGuide.cxBox = rcWnd.right - rcWnd.left; m_hwxGuide.cyBox = rcWnd.bottom - rcWnd.top; m_hwxGuide.cxOffset = DEFAULT_HWXGUIDE_CXOFFSET; m_hwxGuide.cyOffset = DEFAULT_HWXGUIDE_CYOFFSET; m_hwxGuide.cxWriting = (rcWnd.right - rcWnd.left) - m_hwxGuide.cxOffset * 2; m_hwxGuide.cyWriting = (rcWnd.bottom - rcWnd.top) - m_hwxGuide.cyOffset * 2; m_hwxGuide.nDir = HWX_HORIZONTAL; #ifdef RECOGNIZE_FUNCTION_FROM_DLL HINSTANCE hInstDll; hInstDll = LoadLibrary(RECOGNIZE_DLL_PATH); if(hInstDll != NULL) { HWXCONFIG = (DLL_HWXCONFIG) GetProcAddress(hInstDll,TEXT(HwxConfig)); HWXCREATE = (DLL_HWXCREATE) GetProcAddress(hInstDll,TEXT(HwxCreate)); HWXSETGUIDE = (DLL_HWXSETGUIDE) GetProcAddress(hInstDll,TEXT(HwxSetGuide)); HWXALCVALID = (DLL_HWXALCVALID) GetProcAddress(hInstDll,TEXT(HwxALCValid)); HWXALCPRIORITY = (DLL_HWXALCPRIORITY) GetProcAddress(hInstDll,TEXT(HwxALCPriority)); HWXSETCONTEXT = (DLL_HWXSETCONTEXT) GetProcAddress(hInstDll,TEXT(HwxSetContext)); HWXINPUT = (DLL_HWXINPUT) GetProcAddress(hInstDll,TEXT(HwxInput)); HWXPROCESS = (DLL_HWXPROCESS) GetProcAddress(hInstDll,TEXT(HwxProcess)); HWXRESULTSAVAILABLE = (DLL_HWXRESULTSAVAILABLE) GetProcAddress(hInstDll,TEXT(HwxResultsAvailable)); HWXGETRESULTS = (DLL_HWXGETRESULTS) GetProcAddress(hInstDll,TEXT(HwxGetResults)); HWXDESTROY = (DLL_HWXDESTROY)![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)
