Sample WIA Scanner Driver :

(flatbed scanner with a document feeder attached) or

(scanner with a document feeder only that can not determine page length)

[This is preliminary documentation and subject to change.]

SUMMARY

This sample shows how to write a Windows Image Acquisition (WIA) user-mode minidriver for a scanner. It simulates scanning by producing a test pattern image. This sample driver is an excellent starting point for your development, but your driver should access the scanner hardware through one of the kernel drivers provided with Windows, Usbscan.sys or Scsiscan.sys, if possible.

This sample will not work on Windows 98 or Windows 2000.

SAMPLE FEATURES

1.      Automatic document feeder capabilities

a.       This sample also shows an example of a feeder that can not determine the page length. (formally called a scrollfed scanner)

2.      Scan, Copy, and Fax button support. (interrupt events only)

a.       Run the small application provided with the DDK called scanpanl.exe to simulate button presses.

BUILDING THE SAMPLE (flatbed scanner with document feeder attached)

To build the sample follow these steps:

1.      In the Start menu, select  "Free Build Environment" or "Checked Build Environment" under "Windows DDK" to open a command window and set basic environment variables needed to build drivers.

2.      Change to the directory containing the sample driver source code.

3.      Execute the "build" command. After the build completes, a driver named wiascanr.dll will be located in a subdirectory.

BUILDING THE SAMPLE (document feeder only scanner that can not determine page length (formally called a scrollfed scanner))

To build the sample follow these steps:

1.      In the Start menu, select  "Free Build Environment" or "Checked Build Environment" under "Windows DDK" to open a command window and set basic environment variables needed to build drivers.

2.      Change to the directory containing the sample driver source code.

3.      Edit the SOURCES file adding /DUNKNOWN_LENGTH_FEEDER_ONLY_SCANNER to the C_DEFINES section.

a.       Example: C_DEFINES  =$(C_DEFINES) /DUNKNOWN_LENGTH_FEEDER_ONLY_SCANNER

4.      Execute the "build" command. After the build completes, a driver named wiascanr.dll will be located in a subdirectory.

a.       Important note: This driver is the same .dll as the one built above.  It only contains different functionality. A separate installation is not required or recommended.

USING THE SAMPLE

To use the driver, first install it following these steps:

  1. Copy wiascanr.dll from the appropriate object subdirectory under wiascanr to a new, empty directory.
  2. Copy wiascanr.inf  to the same directory.
  3. In Windows Me or Windows XP, open the “New Device” icon located in the Scanners and Cameras control panel.
  4. Click the “Have Disk” button and enter the name of the folder created in step 1.
  5. Click OK, Next, or Finish until the wizard is finished.

Use one of these options to test this driver:

1.      The Scanners and Cameras Wizard accessible from the Start menu or by double-clicking the scanner in Explorer.

2.      The wiatest application provided in this DDK tools directory.

3.      Microsoft Paint, a native WIA application.

4.      Any TWAIN compliant application.

RESOURCES

WIA information: http://www.microsoft.com/hwdev/tech/wia

DDK information: http://www.microsoft.com/ddk/

CODE TOUR

File Manifest

Files        Description
------------ -------------------------------------------------------
istiusd.cpp     Implements STI minidriver for backward compatibility
iwiaminidrv.cpp Implements COM WIA mini-driver functions
makefile        Used for building the driver--do not modify
pch.h           Precompiled header
resource.h      Header file for resources
sources         Controls building of driver
validate.cpp    Implements property validation helpers
wiaprop.h       Property header file
wiascanr.cpp    Implements COM DLL functionality
wiascanr.h      Main DLL header file
wiascanr.rc     Resource definitions
wiascanr.rcv    Version resource definitions
wiascanr.def    DLL exports file
dlihook.cpp     delay load module
wiascanr.htm    This readme file
wiascanr.inf    Installation file for this driver