Jump to content

want to use twain to scan a image from scanner


Recommended Posts

hi,

i want to use the twain dll (click here to download the dll) to scan a image from my scanner to a file.

i found some visual basic (.net) scripts but i can't find out how to do it in AutoIt

the scripts i found:

can someone find out what i have to put in

DllCall("dll","return type","function",["type1","param1",["type n", "param n"]])

Thanks,

Edited by Pakku
Link to comment
Share on other sites

hi,

that's the big problem, what are the API calls?

or where can i find them?

EDIT: oke i found these sites but i don't understand any of these:

http://www.herdsoft.com/ti/davincie/twai8v5a.htm

http://www.herdsoft.com/ti/davincie/twai8v5a.htm

http://www.dynarithmic.com/onlinehelp/dtwain/index.html

Edited by Pakku
Link to comment
Share on other sites

@nfwu

you mean this:

http://www.twain.org/devfiles/twain.h

i found it on this site:

http://www.twain.org/

Edited by Pakku
Link to comment
Share on other sites

Thanks for that, just what I needed.

#)

edit: wtf? I glanced at the header file and got bombarded with a lot of structs and defines!

Anyone else wanna figure this out, I'll provide only the necessary lines of code:

/****************************************************************************
 * Entry Points                                                          *
 ****************************************************************************/

/**********************************************************************
 * Function: DSM_Entry, the only entry point into the Data Source Manager.
 *
 * Parameters:
 *  pOrigin Identifies the source module of the message. This could
 *        identify an Application, a Source, or the Source Manager.
 *
 *  pDest   Identifies the destination module for the message.
 *        This could identify an application or a data source.
 *        If this is NULL, the message goes to the Source Manager.
 *
 *  DG    The Data Group. 
 *        Example: DG_IMAGE.
 *
 *  DAT  The Data Attribute Type.
 *        Example: DAT_IMAGEMEMXFER.
 *  
 *  MSG  The message.  Messages are interpreted by the destination module
 *        with respect to the Data Group and the Data Attribute Type.  
 *        Example: MSG_GET.
 *
 *  pData   A pointer to the data structure or variable identified 
 *        by the Data Attribute Type.
 *        Example: (TW_MEMREF)&ImageMemXfer
 *                 where ImageMemXfer is a TW_IMAGEMEMXFER structure.
 *                  
 * Returns:
 *  ReturnCode
 *       Example: TWRC_SUCCESS.
 *
 ********************************************************************/

/* Don't mangle the name "DSM_Entry" if we're compiling in C++! */
#ifdef  __cplusplus
extern "C" {
#endif  /* __cplusplus */

#ifdef  _MSWIN_
TW_UINT16 FAR PASCAL DSM_Entry( pTW_IDENTITY pOrigin,
                                pTW_IDENTITY pDest,
                                TW_UINT32   DG,
                                TW_UINT16   DAT,
                                TW_UINT16   MSG,
                                TW_MEMREF   pData);

typedef TW_UINT16 (FAR PASCAL *DSMENTRYPROC)(pTW_IDENTITY, pTW_IDENTITY,
                                             TW_UINT32, TW_UINT16,
                                             TW_UINT16, TW_MEMREF);
#else   /* _MSWIN_ */

FAR PASCAL TW_UINT16 DSM_Entry( pTW_IDENTITY pOrigin,
                                pTW_IDENTITY pDest,
                                TW_UINT32   DG,
                                TW_UINT16   DAT,
                                TW_UINT16   MSG,
                                TW_MEMREF   pData);

typedef TW_UINT16 (*DSMENTRYPROC)(pTW_IDENTITY, pTW_IDENTITY,
                                  TW_UINT32,    TW_UINT16,
                                  TW_UINT16,    TW_MEMREF);
#endif  /* _MSWIN_ */

#ifdef  __cplusplus
}
#endif  /* cplusplus */


/**********************************************************************
 * Function: DS_Entry, the entry point provided by a Data Source.
 *
 * Parameters:
 *  pOrigin Identifies the source module of the message. This could
 *        identify an application or the Data Source Manager.
 *
 *  DG    The Data Group. 
 *        Example: DG_IMAGE.
 *         
 *  DAT  The Data Attribute Type.
 *        Example: DAT_IMAGEMEMXFER.
 *  
 *  MSG  The message.  Messages are interpreted by the data source
 *        with respect to the Data Group and the Data Attribute Type.
 *        Example: MSG_GET.
 *
 *  pData   A pointer to the data structure or variable identified 
 *        by the Data Attribute Type.
 *        Example: (TW_MEMREF)&ImageMemXfer
 *                 where ImageMemXfer is a TW_IMAGEMEMXFER structure.
 *                  
 * Returns:
 *  ReturnCode
 *        Example: TWRC_SUCCESS.
 *
 * Note:
 *  The DSPROC type is only used by an application when it calls
 *  a Data Source directly, bypassing the Data Source Manager.
 *
 ********************************************************************/
/* Don't mangle the name "DS_Entry" if we're compiling in C++! */
#ifdef  __cplusplus
extern "C" {
#endif  /* __cplusplus */

#ifdef  _MSWIN_
  #ifdef _WIN32
     __declspec(dllexport) TW_UINT16 FAR PASCAL DS_Entry (pTW_IDENTITY pOrigin,
                                                          TW_UINT32 DG, 
                                                          TW_UINT16 DAT, 
                                                          TW_UINT16 MSG, 
                                                          TW_MEMREF pData);
  #else   /* _WIN32 */
     TW_UINT16 FAR PASCAL DS_Entry (pTW_IDENTITY pOrigin,
                                    TW_UINT32   DG, 
                                    TW_UINT16   DAT, 
                                    TW_UINT16   MSG, 
                                    TW_MEMREF   pData);
  #endif  /* _WIN32 */
  
  typedef TW_UINT16 (FAR PASCAL *DSENTRYPROC) (pTW_IDENTITY pOrigin,
                                               TW_UINT32    DG, 
                                               TW_UINT16    DAT, 
                                               TW_UINT16    MSG, 
                                               TW_MEMREF    pData);
#else   /* _MSWIN_ */
FAR PASCAL TW_UINT16 DS_Entry( pTW_IDENTITY pOrigin, 
                               TW_UINT32    DG, 
                               TW_UINT16    DAT, 
                               TW_UINT16    MSG, 
                               TW_MEMREF    pData);

typedef TW_UINT16 (*DSENTRYPROC)(pTW_IDENTITY,
                                  TW_UINT32,    TW_UINT16,
                                  TW_UINT16,    TW_MEMREF);
#endif  /* _MSWIN_ */

#ifdef  __cplusplus
}
#endif  /* cplusplus */

/*  SDH - 02/08/95 - TWUNK */
/*  Force 32-bit twain to use same packing of twain structures as existing */
/*  16-bit twain.  This allows 16/32-bit thunking. */
#ifdef  WIN32
    #ifdef __BORLANDC__ //(Mentor June 13, 1996) if we're using a Borland compiler
        #pragma option -a.  //(Mentor October 30, 1996) switch back to original alignment
    #else   //(Mentor June 13, 1996) if NOT using a Borland compiler
        #pragma pack (pop, before_twain)
    #endif  //(Mentor June 13, 1996)
#else   /* WIN32 */
#endif  /* WIN32 */

Sorry, but I can see no other functions other than 2 entry points. Are you sure that this is the header file?

#)

Edited by nfwu
Link to comment
Share on other sites

no i don't.

i don't know nothing about dll or the header files

but thanks for what you have done now.

but what the main point of this topic is to scan an image with the scanner. what i thought is to use a dll (the twain dll) but there are maybe other ways.

any suggestions?

Edited by Pakku
Link to comment
Share on other sites

  • 3 years later...
  • 2 years later...
  • 5 months later...
  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...