GetSymbolsHRCRESULT

  1. 0

Retrieves an array of symbol values corresponding to a recognition result. A recognizer must export this function.

int GetSymbolsHRCRESULT( HRCRESULT hrcresult, UINT iSyv, LPSYV rgsyv, UINT cSyv )

Parameters

hrcresult

Handle of a results object.

iSyv

Index of the first symbol of interest in the results object.

rgsyv

Address of a buffer in which to put the symbols. The array must be large enough to store cSyv symbols.

cSyv

The size of rgsyv in symbols (not bytes). This is the number of symbols to be returned. A value of 0 is legal, in which case the function simply returns 0.

Return Value

Returns the count of symbols copied, if successful; otherwise, returns one of the following negative values:

Constant
Description
HRCR_ERROR
Invalid parameter or other error.
HRCR_MEMERR
Insufficient memory.

Comments

It is possible to allocate a small buffer in rgsyv and call this function repeatedly, incrementing the index iSyv each time by the number of symbols returned in the previous call, until the function returns 0.

Example

The following example gets a character result, using a small buffer:

#define CBCHBUF 1024 // Char buffer

#define CSYVMAX 32 // Relatively small symbol chunk

HRC vhrc; // Handle to a handwriting context

HRCRESULT vhrcresult; // Handle to a recognition result

SYV vrgsyv[CSYVMAX]; // Symbol result buffer

char vrgcBuff[CBCHBUF]; // Buffer for recognition results

.

. // Code that creates HRC, gets input, etc....

.

EndPenInputHRC( vhrc ); // Tell recognizer no more ink

ProcessHRC( vhrc, PH_MAX ); // Finish recognition

.

. // Retrieve a handle to the results

.

if (GetResultsHRC( vhrc, &vhrcresult, 1 ) > 0)

{

int i = 0, cSyv;

// Retrieve some symbols

while ((cSyv = GetSymbolsHRCRESULT( vhrcresult,

i, vrgsyv, CSYVMAX )) > 0)

{

if (i + cSyv + 1 > CBCHBUF) // Don't overflow buffer

cSyv = CBCHBUF - i - 1;

if (cSyv > 0) // Still have something?

{

SymbolToCharacter( vrgsyv, cSyv, vrgcBuff + i, NULL );

i += cSyv;

}

if (i + 1 >= CBCHBUF)

break;

}

  • rgcBuff[i] = chNull; // Terminate string

}

DestroyHRCRESULT( vhrcresult ); // We're finished with result

  • hrcresult = NULL;

DestroyHRC( vhrc ); // Finished with this HRC session

  • hrc = NULL;

See Also

GetSymbolCountHRCRESULT
, SYV_

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database