DTWAIN_EnumCameras

Top  Previous  Next

The DTWAIN_EnumCameras function gets all of the "cameras" that are available for the current Source.  The Source must support TWAIN File System handling.

 

LONG DTWAIN_EnumCameras (

DTWAIN_SOURCE

Source,

LPDTWAIN_ARRAY

lpCameraNames );

 

Parameters

Source

An open TWAIN Source.

 

lpCameraNames

Address of a DTWAIN_ARRAY (an LPDTWAIN_ARRAY) that will store the Source's camera names.

 

 

Return Values

The return value is TRUE if successful.  Otherwise FALSE is returned.

 

Comments

The DTWAIN_EnumCameras function gets all of the supported "cameras" that the Source Source supports.  This function is mostly used for duplex scanners and other equipment that have multiple input "cameras" that are responsible for recording the image data from the physical page.  For more information, please see Duplex Camera Processing.  The Source must support the TWAIN File System handling for this function to have any effect.

 

The lpCameraNames is the address of a DTWAIN_ARRAY of type DTWAIN_ARRAYANSISTRING.  On return, this array is filled with the names of each camera that the Source supports.

 

Below is a C/C++ sample of the usage of this function:

 

#include "dtwain.h"

#include <stdio.h>

 

void foo( )

{

   DTWAIN_ARRAY CameraArray;

   DTWAIN_BOOL  Ok;

   LONG Count;

   char szCameraName[256]; /* Must be at least 255 for DTWAIN_STRING's */

   DTWAIN_SOURCE Source;

 

   /* ... */

   /* Assume Source has been opened */

   /* ... */

 

   /* Discover all the camera names */

   Ok = DTWAIN_EnumCameras( Source, &CameraArray );

   if ( Ok )

   {

         LONG current;

         /* Get the number of camera names found */

         Count = DTWAIN_ArrayGetCount( CameraArray );

 

        /* print out each of the names */

         for ( current = 0; current < Count; ++current )

         {

            /* Since each element of the DTWAIN_ARRAY is made up of ANSI strings, use

               DTWAIN_ArrayGetAtANSIString to retrieve the info */

             DTWAIN_ArrayGetAtANSIString( CameraArray, current, szCameraName );

             printf ("Camera name %d is %s\n", current+1, szCameraName );

       }

      DTWAIN_ArrayDestroy( CameraArray );

    }            

}

 

Output::

Camera name 1 is \Camera_Bitonal

Camera name 2 is \Camera_Color

 

 

TWAIN State Transitions

The Source must be in State 4 or higher

 

Prerequisite Function Call(s)

DTWAIN_SysInitialize

DTWAIN Source Selection Function

 

 

See Also

Duplex Camera Processing