<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<META NAME="Generator" CONTENT="Microsoft Word 97">
<TITLE>HP ScanJet 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">HP ScanJet 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. It can be used with almost any Hewlett-Packard ScanJet scanner.<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 Hpsjusd directory, and use the <B>build</B> command. Before you can use the sample, you need to install an HP scanner from the list in Hpscan.inf. Although a copy of Hpscan.inf is included in this directory, it is not needed. The system will use %SystemRoot%\Inf\Hpscan.inf to install. If you make any changes to Hpscan.inf, be sure to delete Hpscan.pnf, if it exists.<P>

To install the scanner, shut down the machine, attach the scanner, and boot. The scanner will be detected and installed by Windows 2000.<P>

Once the scanner is installed, you can copy the built sample, Hpsjusd.dll, into %SystemRoot%\System32. If the existing minidriver is in use, stop the Still Image service using the Computer Management application, and restart it after copying.<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&#174; 6.0. Plug and Play and Power Management are handled by lower drivers in the stack (Scsiscan.sys). <P>

Building this sample produces three files: Hpsjusd.dll, Hpsjusd.lib, and Hpsjusd.exp. Both free and checked versions are buildable. The sample has been tested with a binary that was built with Visual C&#174; 5.0.<P>

<H3>TOOLS</H3> </FONT><FONT FACE="Verdana" SIZE=2><P>
The minidriver is used by three software components: the Scanners and Cameras control panel, the Still Image service, and by an imaging application indirectly through a TWAIN data source. 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, and a TWAIN data source will acquire an image through the minidriver.<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 that the control panel calls (for example, <B>GetStatus</B>, <B>Diagnostic</B>, <B>Initialize</B>, <B>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>. To debug an application's or TWAIN data source's use of the minidriver, use the application as the command for the debugger and acquire an image using the application. Almost any function in the minidriver can be called, but <B>RawReadData</B> and <B>RawWriteData</B>, in particular, will be of interest. If the scanner supports events (i.e., if it has the <B>Copy</B> button on it), 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>
Also see <A HREF="http://www.dmo.hp.com/devexchange/nam/toolkit_reg.html">Hewlett-Packard ScanJet Developers Information</A>.


<H3>CODE TOUR</H3>
<H4>File Manifest</H4>
</FONT><U><PRE>File&#9;&#9;	Description
</U>
Hpsjusd.htm&#9; 	The documentation for this sample (this file)
Hpsjusd.cpp&#9; 	Implements DLL and COM housekeeping
Device.cpp&#9;  	Implements the functions of the minidriver
Hpsjusd.h&#9;   	Main header file
Sclbuton.h&#9;  	SCL (scanner command language) definitions
Hpsjusd.rc&#9;  	Main resource file
Hpsjusd.rcv&#9; 	Contains version resource
Makefile&#9;    	The makefile for the project; do not edit.
Sources&#9;     		DDK build instructions
Hpsjusd.def&#9; 	DLL definition
Hpscan.inf&#9;  	Installation information for the sample

</pre></FONT><FONT FACE="Verdana" SIZE=2><P><H4>Programming Tour</H4></FONT><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>&copy; 1999 Microsoft Corporation</FONT><FONT FACE="Verdana" SIZE=2> </P></FONT></BODY>
</HTML>
