NOTE: User words and dictionaries are no longer supported in the OCR Professional Engine.
#include "ltdoc2.h"
L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2GetUserDictionary(hDoc, pUDOpts, uStructSize)
L_HDOC2 hDoc; |
handle to the OCR document |
pUSERDICTIONARY2 pUDOpts; |
pointer to a USERDICTIONARY2 structure |
L_UINT uStructSize; |
size of the structure |
Gets the name of the current User dictionary and its default section.
Parameter |
Description |
hDoc |
Handle to the OCR document. |
pUDOpts |
Pointer to a USERDICTIONARY2 structure to be updated |
uStructSize |
Size in bytes, of the structure pointed to by pUDOpts, use sizeof(USERDICTIONARY2) to calculate this value. |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Gets the name of the current User dictionary and its default section to be used in the recognition process.
To set a User dictionary and its default section, call the L_Doc2SetUserDictionary function.
To recognize a page, call the L_Doc2Recognize function.
Required DLLs and Libraries
LTDOC2 For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
L_INT Doc2GetUserDictionaryExample(L_HDOC2 hDoc)
{
L_INT nRet;
USERDICTIONARY2 UDOpts;
ZeroMemory(&UDOpts, sizeof(USERDICTIONARY2));
nRet = L_Doc2GetUserDictionary(hDoc, &UDOpts, sizeof(USERDICTIONARY2));
if (nRet == SUCCESS)
{
L_TCHAR szBuffer[1024];
ZeroMemory(szBuffer, sizeof(szBuffer));
wsprintf(szBuffer, TEXT("User Dictionary Name = %s\nDefault Section Name = %s\n"),
UDOpts.pszFileName,
UDOpts.pszDefSection);
MessageBox(NULL, szBuffer, TEXT("User Dictionary Info"), MB_OK);
if (L_Doc2GetUserDictionaryState(hDoc))
MessageBox(NULL, TEXT("The current user dictionary is changed."), TEXT("Notice!"), MB_OK);
else
MessageBox(NULL, TEXT("The current user dictionary is not changed."), TEXT("Notice!"), MB_OK);
L_CHAR szSection[DOC2_MAX_SECTION_NAME_LENGTH];
ZeroMemory(szSection, sizeof(szSection));
nRet = L_Doc2GetUserDictionarySection(hDoc, szSection, DOC2_MAX_SECTION_NAME_LENGTH, TRUE);
if (nRet == SUCCESS)
{
ZeroMemory(szBuffer, sizeof(szBuffer));
wsprintf(szBuffer, TEXT("First Section in the current User Dictionray = %s\n"), szSection);
MessageBox(NULL, szBuffer, TEXT("First Section"), MB_OK);
L_WCHAR * pwcItem = (L_WCHAR *)GlobalAllocPtr(GHND, 512 * sizeof(L_WCHAR));
if (pwcItem)
{
L_UINT32 uMask = 0;
nRet = L_Doc2GetUserDictionarySectionItem(hDoc, szSection, pwcItem, 512 * sizeof(L_WCHAR), &uMask, TRUE);
if (nRet == SUCCESS)
{
L_TCHAR szItem[512];
ZeroMemory(szItem, sizeof(szItem));
WideCharToMultiByte(0, 0, pwcItem, -1, (LPSTR) szItem, 512, NULL, NULL);
ZeroMemory(szBuffer, sizeof(szBuffer));
wsprintf(szBuffer, TEXT("1st Section Item in the 1st section of the current User Dictionray = %s\n"), szItem);
MessageBox(NULL, szBuffer, TEXT("First Section Item"), MB_OK);
}
else
return nRet;
GlobalFreePtr(pwcItem);
}
else
return nRet;
}
else
return nRet;
}
else
return nRet;
return SUCCESS;
}