L_DocSetUserDictionary
#include "ltdoc.h"
L_INT EXT_FUNCTION L_DocSetUserDictionary(hDoc, pUDOpts , bCreateUD)
L_HDOC hDoc; |
/* handle to the OCR document */ |
pUSERDICTIONARY pUDOpts; |
/* pointer to USERDICTIONARY */ |
L_BOOL bCreateUD; |
/* flag */ |
Sets the User dictionary and its default section for the checking subsystem.
Parameter |
Description |
|
hDoc |
Handle to the OCR document. |
|
pUDOpts |
Pointer to a USERDICTIONARY structure which contains the user dictionary to be set. |
|
bCreateUD |
Flag to determine function behavior. Valid values as follows: |
|
|
Value |
Meaning |
|
TRUE |
Creates new user dictionary in memory |
|
FALSE |
Saves the current user dictionary into the file indicated in the pUDOpts parameter. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
Specifies a User dictionary and its default section for the checking subsystem.
This function can also be used to initiate the creation of a new, empty User dictionary in memory.
To disable a previously enabled User dictionary, pass TRUE for bCreateUD when calling L_DocSetUserDictionary.
When creating a new, empty User dictionary, pass TRUE for bCreateUD.
If you save a user dictionary by calling this function with bCreateUD set to FALSE the user dictionary is saved to the file specified in pUDOpts. If you later want to set the user dictionary to use this file, call L_DocSetUserDictionary with the name of the file that contains the user dictionary set in the pUDOpts parameter of this function and pass FALSE for the bCreateUD parameter.
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
void TestCreateUD(L_HDOC hDoc)
{
USERDICTIONARY UDict;
UDict.pszFileName = NULL;
UDict.pszDefSection = NULL;
// creates new user dictionary in memory
L_INT nRet = L_DocSetUserDictionary(hDoc, &UDict, TRUE);
if (nRet == SUCCESS)
{
L_CHAR * pszSectName = "cities";
L_WCHAR * pwcItem1 = L"Peabody";
L_WCHAR * pwcItem2 = L"Budapest";
L_DocAddItemToUserDictionary(hDoc, pszSectName, pwcItem1, USER_DICT_LITERAL);
L_DocAddItemToUserDictionary(hDoc, pszSectName, pwcItem2, USER_DICT_LITERAL);
UDict.uStructSize = sizeof(USERDICTIONARY);
UDict.pszFileName = TEXT("USERDIC1.DIC");
UDict.pszDefSection = pszSectName;
nRet = L_DocSetUserDictionary(hDoc, &UDict, FALSE);
if (nRet == SUCCESS)
MessageBox(NULL, TEXT("The user dictionary is saved into a file."), TEXT("Notice!"), MB_OK);
}
}