70 lines
6.4 KiB
HTML
70 lines
6.4 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
|
|
<META NAME="Generator" CONTENT="Microsoft Word 97">
|
|
<TITLE>Sample STI User-mode Minidriver</TITLE>
|
|
<META NAME="Template" CONTENT="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
|
|
</HEAD>
|
|
<BODY TEXT="#000000" LINK="#0000ff" VLINK="#800080" BGCOLOR="#ffffff" leftmargin="8">
|
|
|
|
<FONT FACE="Verdana"><H2><A NAME="MYSAMPLE">Sample STI User-mode Minidriver</A> </H2>
|
|
|
|
<span style="color:#FF0000">[This is preliminary documentation and subject to change.]</span>
|
|
|
|
<H3>SUMMARY</H3></FONT><FONT FACE="Verdana" SIZE=2><P>
|
|
This sample is a working example of an STI (Still Image) user-mode minidriver. The main purpose of this sample is to show how to implement events in the minidriver. Events are hardware-initiated, usually caused when the user pushes a button on the device. Rather than require the installation of hardware, this sample uses a test file to simulate hardware events. When the test file changes or changes size, the minidriver simulates a hardware event.<P>
|
|
|
|
This user-mode minidriver sample works in conjunction with a sample control panel found in the Sampcpl directory. Both parts need to be built to run this example.<P>
|
|
|
|
<H3>BUILDING THE SAMPLE</H3></FONT><FONT FACE="Verdana" SIZE=2><P>
|
|
To build the sample, open a DDK command window, change to the Sampusd directory, and use the <B>build</B> command. After building, put the Sampusd.dll and Sampusd.inf files in a temporary directory with the Sampcpl.cpl file built from the Sampcpl directory of the DDK. To install it, use the Hardware Wizard control panel, or the <B>Add</B> button in the Scanners and Cameras control panel. When prompted by the wizard to search for your new hardware, select <B>No</B>, and then select <B>Imaging Device</B> from the next dialog box.<P>
|
|
|
|
Use the <B>Have Disk</B> button to point to the temporary directory where the files are located. The wizard will ask if the device is attached to COM1 or COM2. It doesn't matter which one you choose, as this value will be changed later. In the Scanners and Cameras control panel, select <B>Properties</B> of the sample device. It will initially read, "Status: Unavailable." On the <B>Sample USD</B> tab, type in the name of a temporary test file (for example, C:\Temp\Sample.txt). Create the test file if it does not already exist. The value will not be updated in the control panel until the Still Image Service is restarted. Open the Computer Manager (right-click <B>My Computer</B> and select <B>Manage</B>), select <B>System Tools</B>, and then <B>Services</B>, and stop and then restart the Still Image service.<P>
|
|
|
|
To simulate an event, use the test file created above. Changing the test file's size will cause a File Size Changed event. Altering the file without changing its size will cause a File Time Changed event. These events can be linked to different applications using the <B>Event</B> tab in the Scanners and Cameras control panel. Try causing each of these events and watch the applications launch.<P>
|
|
|
|
This sample has not been tested on Alpha platforms. It has not been confirmed to be 64-bit compliant. The code builds properly with Microsoft Visual C® 6.0. Plug and Play and Power Management are not applicable to this sample.<P>
|
|
|
|
Building this sample produces three files: Sampusd.dll, Sampusd.lib, and Sampusd.exp. Both free and checked versions are buildable. The sample has been tested with a binary that was built with Visual C 5.0.<P>
|
|
|
|
<H3>TOOLS</H3></FONT><FONT FACE="Verdana" SIZE=2><P>
|
|
The minidriver is used by two software components: the Scanners and Cameras control panel and the Still Image service. The Control Panel uses the minidriver to check on the status of the device. The Still Image service will check if the device has an event pending.<P>
|
|
|
|
By building and using a checked (debug) version of the minidriver and a debugger, you can examine how it works in each of these instances. To debug the minidriver when it is called by the Control Panel, use <B>control sticpl.cpl</B> as the command for the debugger to execute. Put a breakpoint in one or more of the functions in Device.cpp that the control panel calls (e.g. <B>GetStatus</B>, <B>Diagnostic</B>, <B>Initialize, LockDevice</B>, <B>UnLockDevice</B>). To debug the minidriver when it is called by the Still Image service, use <B>stisvc.exe -a</B> as the command and put a breakpoint in <B>GetStatus</B>, <B>Initialize</B>, <B>DeviceReset</B>, <B>LockDevice</B>, or <B>UnLockDevice</B>. Since this sample also support events, the <B>GetNotificationData</B> function will also be of interest.<P>
|
|
|
|
The Stillvue application in the Scancam\App directory of this DDK can be used to test any function in the minidriver. See the documentation in that directory for more information.<P>
|
|
|
|
<H3>RESOURCES</H3></FONT><FONT FACE="Verdana" SIZE=2><P>
|
|
More information on TWAIN can be found at <A HREF="http://www.twain.org">http://www.twain.org</A>.<P>
|
|
To get a logo for your device, consult <A HREF="http://www.microsoft.com/hwtest">WHQL</A> for information and test suites.<P>
|
|
Your device should support Plug and Play, even if it uses the parallel or serial port. Download Plug and Play specs from their <A HREF="http://www.microsoft.com/hwdev/respec/pnpspecs.htm">Web site</A>.<P>
|
|
|
|
<H3>CODE TOUR</H3>
|
|
<H4>File Manifest</H4>
|
|
</FONT><U><PRE>File		 Description
|
|
</U>
|
|
Sampusd.htm	 The documentation for this sample (this file)
|
|
Sampusd.cpp	 Implements DLL and COM housekeeping
|
|
Device.cpp	 Implements the functions of the minidriver
|
|
Sampusd.h	 Main header file
|
|
Sampusd.rc	 Main resource file
|
|
Sampusd.rcv	 Contains version resource
|
|
Resource.h	 Resource defines (currently empty)
|
|
Makefile	 The makefile for the project; do not edit.
|
|
Sources	 DDK build instructions
|
|
Sampusd.def	 DLL definition
|
|
Sampusd.inf	 Installation information for the sample
|
|
|
|
</PRE></Font><h4>Programming Tour</h4><FONT FACE="Verdana" SIZE=2><P>
|
|
Each of the functions implemented in device.cpp is documented in the DDK documentation under Still Image Interfaces, IStiUSD Interface.<P>
|
|
</FONT><P ALIGN="CENTER"><A HREF="#top"><FONT FACE="Verdana" SIZE=2>Top of page</FONT></A><FONT FACE="Verdana" SIZE=2> </P></FONT>
|
|
<TABLE CELLSPACING=0 BORDER=0 WIDTH=624>
|
|
<TR><TD VALIGN="MIDDLE" BGCOLOR="#00ffff" HEIGHT=2>
|
|
<P></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<FONT FACE="MS Sans Serif" SIZE=1><P>© 1999 Microsoft Corporation</FONT><FONT FACE="Verdana" SIZE=2> </P></FONT></BODY>
|
|
</HTML>
|
|
</HTML>
|