Init

#include "BiTwain.h"

 

int CALLBACK Init(HWND hWnd)

Description

This function should be called to initialize the TWAIN driver. The hWnd parameter must be a valid window handle. This window gets the messages from BiTwain. You must register the message with the RegisterWindowMessage API function to get messages from BiTwain.

m_iBiTwainMsg = RegisterWindowMessage(STR_BI_WINDOW_MESSAGE);

This function loads the Twain 2.0 or later data source manager (TWAINDSM.dll) by default. In some cases it might be necessary to use the Twain 1.9 or older data source manager (twain_32.dll), if the scanner does not support the 2.0 or later data source manager, or when using Citrix scanner redirection. The InitExt function can be used instead of the Init function to specify the Twain data source manager DLL name. Alternatively, the name of the data source manager DLL can be also specified in the BiTwain.ini file. The BiTwain.ini should be in the same directory as BiTwain.dll. The name of the data source manager can be specified in the “Twain DLL Name” key of the [Twain] INI file section:

[Twain]
Twain DLL Name=TWAINDSM.dll

Full path can also be specified instead of just the DLL name. The DLL is loaded from the default locations specified in the PATH environment variable if the full path is not specified.

Parameters

HWND

hWnd

The handle for the main window.

Return values

Return TW_OK on success or an error code on failure.

Requirements

Header :     Declared in BiTwain.h; include BiTwain.h.

Library :    Use BiTwain.lib.

DLLs :       BiTwain.dll.