⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flyerapi.cpp

📁 三星2440下的手写程序.没有字库,因有版权问题.
💻 CPP
字号:
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include "HWAPI.H"
#include "FLYERAPI.h"

long pRam[HWRERAMSIZE / 4];

THWAttribute attr;

unsigned char* pRom;

int HWRE_LoadDict(unsigned char** hDic)
{
	FILE *in;
	long nLen;
	unsigned char* pDic;

	in = fopen("\\CHS_Unicode_LittleEndian.dic", "rb");
	if (in == NULL)
	{
		printf("open dict fault...");
		return -1;
	}

	fseek(in, 0, SEEK_END );
	nLen = ftell(in);
	fseek(in, 0, SEEK_SET );

	pDic = (unsigned char*) malloc(nLen);
	if (pDic == NULL)
	{
		fclose(in);
		return -2;
	}

	fread(pDic, 1, nLen, in);
	fclose(in);

	*hDic = pDic;

	return 0;
}

void HWRE_FreeDict(unsigned char** hDic)
{
	if (hDic != NULL && *hDic != NULL)
	{
		free(*hDic);
		*hDic = NULL;
	}

	return;
}
//===================================================================
int initialize()
{
	printf("initialize dict\n");
#if HANWANG_INTEGRATED_DICT == 0

	if (HWRE_LoadDict(&pRom) == 0) //load dictionary

	{
		attr.pRom = pRom;
		return 0;
	}
	else
		return 0;
#endif
	return -1;
}
//===================================================================
int getCode(THWPoint aPenData[], unsigned short Result[])
{
	attr.pRam = (unsigned char*) pRam;
	attr.iCandidateNum = MAXCANDNUM; 
	attr.dwRange = CHARSET_CNDEFAULT;

	printf("---Recognize Begin---\n");

	int iCodeNum = HWRecognize(aPenData, &attr, Result);
	if (iCodeNum <= 0)
	{
		printf("error argument or invalid data!\n");
		return -1;
	}
	else
	{
		int j;
		for (j = 0; j < iCodeNum; j++)
		{
			printf("%04X ", Result[j]);
		}
		printf("\n");
	}

	printf("---Recognize End---\n\n");

	return 0;
}

int release()
{
	printf("release dict\n");
#if HANWANG_INTEGRATED_DICT == 0
	HWRE_FreeDict(&pRom);
#endif
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -