Sample WIA Camera Driver

[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 camera. It simulates a camera by reading images from a directory on the hard disk. It also simulates events through a pop-up dialog. This sample driver can be used as a starting point for your development, but your driver should access the camera hardware through one of the kernel drivers provided with Windows or by directly accessing the port, as with serial.

At the time of this writing, WIA is only supported on Windows Me and Whistler. This sample will not work on Windows 98 or Windows 2000.

BUILDING THE SAMPLE

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, src\wdm\wia\testcam.

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

4.      Also build the user interface extension located in the src\wdm\wia\extend directory.

USING THE SAMPLE

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

  1. Copy Testcam.dll from the appropriate object subdirectory under Testcam to a new, empty directory.
  2. Copy Testcam.inf to the same directory.
  3. Copy Extend.dll from the appropriate object subdirectory under Extend to the same directory.
  4. Copy Tcamlogo.jpg and Testcam.ico from the Extend directory to the same directory.
  5. In Windows Me or Whistler, open the “New Device” icon in the Scanners and Cameras control panel.
  6. Click the “Have Disk” button and enter the name of the folder created in step 1.
  7. 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.

2.      The Namespace extension accessible by opening the camera in Explorer.

3.      The Wiatest application provided in this DDK.

4.      Microsoft Paint, a native WIA application.

5.      Any TWAIN compliant application.

RESOURCES

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

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

CODE TOUR

File Manifest

Files        Description
------------ -------------------------------------------------------
camevent.cpp Implements events
camopen.cpp  Implements opening the camera object
camxfer.cpp  Implements transferring images
defprop.h    Property header file
device.cpp   Implements STI minidriver for backward compatibility
makefile     Used for building the driver--do not modify
miniitem.cpp Implements handling of items
resource.h   Header file for resources
sources      Controls building of driver
tcamprop.h   Camera properties
testcam.def  Linker command file
testcam.htm  This readme
testcam.inf  Installation file
testusd.cpp  Implements COM functionality
testusd.h    Main header file
testusd.rc   Resource definitions
version.h    Version defines
wiadev.cpp   WIA function implementations

Programming Tour

To be provided in a later release.