LEADTOOLS OCR C DLL Help > Function References > OCR Plus > L_DocGetUserDictionary |
#include "ltdoc.h"
L_LTDOC_API L_INT L_DocGetUserDictionary(hDoc, pUDOpts, uStructSize)
L_HDOC hDoc; |
/* handle to the OCR document */ |
pUSERDICTIONARY pUDOpts; |
/* pointer to a USERDICTIONARY 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 USERDICTIONARY structure to be updated. |
uStructSize |
Specifies the size of the structure pointed to by pUDOpts, use sizeof(USERDICTIONARY) to calculate this value. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
Gets the name of the current User dictionary and its default section that used in the recognition process.
To set a User dictionary and its default section, call L_DocSetUserDictionary.
To recognize a page, call L_DocRecognize.
Required DLLs and Libraries
LTDOC For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
See Also
Example
L_INT DocGetUserDictionaryExample(L_HDOC hDoc) { L_INT nRet; USERDICTIONARY UDOpts; ZeroMemory(&UDOpts, sizeof(USERDICTIONARY)); nRet = L_DocGetUserDictionary(hDoc, &UDOpts, sizeof(USERDICTIONARY)); 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_DocGetUserDictionaryState(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[MAX_SECTION_NAME_LENGTH]; ZeroMemory(szSection, sizeof(szSection)); nRet = L_DocGetUserDictionarySection(hDoc, szSection, 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_DocGetUserDictionarySectionItem(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; }