Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef __TTWAINP_H__
Toshihiro Shimizu 890ddd
#define __TTWAINP_H__
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "ttwain.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef TTWAINLIB_MAIN
Toshihiro Shimizu 890ddd
#define EXTERN
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define EXTERN extern
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef __cplusplus
Toshihiro Shimizu 890ddd
extern "C" {
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef enum TWAINSTATE {
Toshihiro Shimizu 890ddd
	TWAIN_PRESESSION = 1, /* source manager not loaded  */
Toshihiro Shimizu 890ddd
	TWAIN_SM_LOADED,	  /* source manager loaded      */
Toshihiro Shimizu 890ddd
	TWAIN_SM_OPEN,		  /* source manager open	      */
Toshihiro Shimizu 890ddd
	TWAIN_SOURCE_OPEN,	/* source open but not enabled*/
Toshihiro Shimizu 890ddd
	TWAIN_SOURCE_ENABLED, /* source enabled to acquire  */
Toshihiro Shimizu 890ddd
	TWAIN_TRANSFER_READY, /* image ready to transfer    */
Toshihiro Shimizu 890ddd
	TWAIN_TRANSFERRING	/* image in transit	      */
Toshihiro Shimizu 890ddd
} TWAINSTATE;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef WIN32
Toshihiro Shimizu 890ddd
#ifdef x64
Toshihiro Shimizu 890ddd
#define DSM_FILENAME "TWAINDSM.DLL"
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DSM_FILENAME "TWAIN_32.DLL"
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
#define DSM_ENTRYPOINT "DSM_Entry"
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DSM_FILENAME ""
Toshihiro Shimizu 890ddd
#define DSM_ENTRYPOINT ""
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
struct TRANSFER_INFO {
Toshihiro Shimizu 890ddd
	TTWAIN_TRANSFER_MECH transferMech; /*current transfer mechanism      */
Toshihiro Shimizu 890ddd
	TTWAIN_USAGE_MODE usageMode;
Toshihiro Shimizu 890ddd
	/*used by buffered memory tranfer */
Toshihiro Shimizu 890ddd
	unsigned char *memoryBuffer;
Toshihiro Shimizu 890ddd
	unsigned long memorySize;
Toshihiro Shimizu 890ddd
	/*used by native tranfer          */
Toshihiro Shimizu 890ddd
	void *hDib;
Toshihiro Shimizu 890ddd
	/*common to all the transfer mode */
Toshihiro Shimizu 890ddd
	int preferredLx;
Toshihiro Shimizu 890ddd
	int preferredLy;
Toshihiro Shimizu 890ddd
	int multiTransfer;
Toshihiro Shimizu 890ddd
	int nextImageNeedsToBeInverted;
Toshihiro Shimizu 890ddd
	int lastTransferWasOk;
Toshihiro Shimizu 890ddd
	TW_PENDINGXFERS pendingXfers;
Toshihiro Shimizu 890ddd
	int oneAtLeast;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
struct CALLBACKS {
Toshihiro Shimizu 890ddd
	TTWAIN_ONDONE_CB *onDoneCb;
Toshihiro Shimizu 890ddd
	void *onDoneArg;
Toshihiro Shimizu 890ddd
	TTWAIN_ONERROR_CB *onErrorCb;
Toshihiro Shimizu 890ddd
	void *onErrorArg;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
struct _TTWAIN_DATA__ {
Toshihiro Shimizu 890ddd
	/*HANDLE*/
Toshihiro Shimizu 890ddd
	DSMENTRYPROC DSM_Entry; /* entry point of Data Source Manager(TWAIN.DLL)*/
Toshihiro Shimizu 890ddd
	TW_INT32 hwnd32SM;		/* window handle              */
Toshihiro Shimizu 890ddd
	/*IDENTITY*/
Toshihiro Shimizu 890ddd
	TW_IDENTITY sourceId;	 /* source identity structure  */
Toshihiro Shimizu 890ddd
	TW_IDENTITY appId;		  /* Application Ident. for DS  */
Toshihiro Shimizu 890ddd
	TW_USERINTERFACE twainUI; /*                            */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int initDone;
Toshihiro Shimizu 890ddd
	TWAINAVAILABLE twainAvailable;
Toshihiro Shimizu 890ddd
	TWAINSTATE twainState; /* the current twain state    */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	struct TRANSFER_INFO transferInfo;
Toshihiro Shimizu 890ddd
	struct CALLBACKS callback;
Toshihiro Shimizu 890ddd
	TW_ARRAY *supportedCaps; /* all the (exported)supported capabilities */
Toshihiro Shimizu 890ddd
	int isSupportedCapsSupported;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int breakModalLoop;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int UIStatus; /* Hide or Show UserInterface */
Toshihiro Shimizu 890ddd
	int modalStatus;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TW_INT16 resultCode; /* result code for LAST error     */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TUINT32 ErrRC; /* result & condition code        */
Toshihiro Shimizu 890ddd
	TUINT32 ErrCC; /* for LAST RECORDED error        */
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
EXTERN struct _TTWAIN_DATA__ TTwainData;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
EXTERN int TTWAIN_InitVar(void);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef __cplusplus
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif