Shinya Kitaoka 810553
#pragma once
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 {
Shinya Kitaoka 120a6e
  TWAIN_PRESESSION = 1, /* source manager not loaded  */
Shinya Kitaoka 120a6e
  TWAIN_SM_LOADED,      /* source manager loaded      */
Shinya Kitaoka 120a6e
  TWAIN_SM_OPEN,        /* source manager open	      */
Shinya Kitaoka 120a6e
  TWAIN_SOURCE_OPEN,    /* source open but not enabled*/
Shinya Kitaoka 120a6e
  TWAIN_SOURCE_ENABLED, /* source enabled to acquire  */
Shinya Kitaoka 120a6e
  TWAIN_TRANSFER_READY, /* image ready to transfer    */
Shinya Kitaoka 120a6e
  TWAIN_TRANSFERRING    /* image in transit	      */
Toshihiro Shimizu 890ddd
} TWAINSTATE;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 9f5a1b
#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 {
Shinya Kitaoka 120a6e
  TTWAIN_TRANSFER_MECH transferMech; /*current transfer mechanism      */
Shinya Kitaoka 120a6e
  TTWAIN_USAGE_MODE usageMode;
Shinya Kitaoka 120a6e
  /*used by buffered memory tranfer */
Shinya Kitaoka 120a6e
  unsigned char *memoryBuffer;
Shinya Kitaoka 120a6e
  unsigned long memorySize;
Shinya Kitaoka 120a6e
  /*used by native tranfer          */
Shinya Kitaoka 120a6e
  void *hDib;
Shinya Kitaoka 120a6e
  /*common to all the transfer mode */
Shinya Kitaoka 120a6e
  int preferredLx;
Shinya Kitaoka 120a6e
  int preferredLy;
Shinya Kitaoka 120a6e
  int multiTransfer;
Shinya Kitaoka 120a6e
  int nextImageNeedsToBeInverted;
Shinya Kitaoka 120a6e
  int lastTransferWasOk;
Shinya Kitaoka 120a6e
  TW_PENDINGXFERS pendingXfers;
Shinya Kitaoka 120a6e
  int oneAtLeast;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
struct CALLBACKS {
Shinya Kitaoka 120a6e
  TTWAIN_ONDONE_CB *onDoneCb;
Shinya Kitaoka 120a6e
  void *onDoneArg;
Shinya Kitaoka 120a6e
  TTWAIN_ONERROR_CB *onErrorCb;
Shinya Kitaoka 120a6e
  void *onErrorArg;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
struct _TTWAIN_DATA__ {
Shinya Kitaoka 120a6e
  /*HANDLE*/
Shinya Kitaoka 120a6e
  DSMENTRYPROC DSM_Entry; /* entry point of Data Source Manager(TWAIN.DLL)*/
Shinya Kitaoka 120a6e
  TW_INT32 hwnd32SM;      /* window handle              */
Shinya Kitaoka 120a6e
  /*IDENTITY*/
Shinya Kitaoka 120a6e
  TW_IDENTITY sourceId;     /* source identity structure  */
Shinya Kitaoka 120a6e
  TW_IDENTITY appId;        /* Application Ident. for DS  */
Shinya Kitaoka 120a6e
  TW_USERINTERFACE twainUI; /*                            */
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int initDone;
Shinya Kitaoka 120a6e
  TWAINAVAILABLE twainAvailable;
Shinya Kitaoka 120a6e
  TWAINSTATE twainState; /* the current twain state    */
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  struct TRANSFER_INFO transferInfo;
Shinya Kitaoka 120a6e
  struct CALLBACKS callback;
Shinya Kitaoka 120a6e
  TW_ARRAY *supportedCaps; /* all the (exported)supported capabilities */
Shinya Kitaoka 120a6e
  int isSupportedCapsSupported;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int breakModalLoop;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int UIStatus; /* Hide or Show UserInterface */
Shinya Kitaoka 120a6e
  int modalStatus;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TW_INT16 resultCode; /* result code for LAST error     */
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TUINT32 ErrRC; /* result & condition code        */
Shinya Kitaoka 120a6e
  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