DTWAIN_SelectOCREngine2
|
The DTWAIN_SelectOCREngine2 function allows the user to select an OCR engine from a list of supported OCR Engines.
DTWAIN_OCRENGINE DTWAIN_SelectOCREngine2 (
Parameters hWndParent Points to the window that will be the parent of the OCR Select dialog, or NULL if no parent window.
szTitle Optional title, or NULL.
xpos, ypos Position of the Select Source dialog with respect to the parent window.
flags Optional window placement flags.
Return Values If successful, the return value is a non-zero DTWAIN_OCRENGINE handle. Otherwise NULL is returned.
Character specific version
Comments The DTWAIN_SelectOCREngine function displays the DTWAIN Select OCR Engine dialog box and returns a handle to the selected OCR Engine. If the user chooses 'Cancel' from the dialog, DTWAIN_SelectOCREngine returns NULL.
To determine if a NULL return value from DTWAIN_SelectOCREngine is due to the user cancelling the dialog or if there is another error, call DTWAIN_GetLastError and check if the value is non-zero (which means an error occurred). If DTWAIN_GetLastError returned 0, this means that the user canceled the dialog, which is perfectly valid for the user to do.
The DTWAIN_OCRENGINE return value is used for any other DTWAIN function that requires an OCR Engine handle.
The difference between DTWAIN_SelectOCREngine2 and DTWAIN_SelectOCREngine is that DTWAIN_SelectOCREngine2 allows the application to position the Select OCR dialog on the screen and place a title on the window. The hWndParent sets the dialog's parent window to hWndParent. If no parent window is desired, hWndParent must be NULL or 0. If hWndParent is NULL, the parent window is the entire screen.
Another difference is that DTWAIN_SelectOCREngine2 will allow the various controls within the dialog to use a custom language setting. Depending on the resources loaded (see DTWAIN_LoadLanguageResource and DTWAIN_LoadCustomStringResource), the various controls and buttons will display the text in the language selected.
The xpos and ypos arguments place the window at position (xpos, pos) with respect to the parent window (if no parent window, xpos and ypos are relative to the entire screen).
The szTitle argument is a null-terminated string that represents the title to display on the window. If szTitle is NULL, the title will be the localized string representing the English text "Select OCR Engine".
The flags parameter determine whether the dialog will be centered and whether the list of names displayed will be sorted. A list of available flag options are as follows (multiple options can be selected by adding the values together).
To change the language used for the various buttons and text, a call to DTWAIN_LoadCustomStringResources can be used. If DTWAIN_LoadCustomStringResources is used, the following DTWAIN constants define the various components of the dialog:
TWAIN State Transitions Remains in State 3.
Prerequisite Calls Optional Prerequisite Calls None. |