BINPRN DLL (16 and 32-bit versions)
===================================
SoftCircuits Programming
http://www.softcircuits.com

The BINPRN DLLs were written to be called from Visual Basic. They
copy a file, which has been formatted for a particular printer,
directly to the printer without further modification. The two
DLLs are called BINPRN16.DLL and BINPRN32.DLL for 16 and 32-bit
Windows, respectively.

The DLLs export a function named vbSendPrnToDefPrinter. This
function takes a single argument, the fully-qualified name of the
file you want sent to the printer. The return value is 0 if the
function succeeds or an error code if it fails. Both the 16 and
32-bit declarations are shown below including the return error
codes.

The 32-bit version provides two additional functions,
vbSendPrnToPrinter, which will send a file to a printer device
that you specific, and vbGetDefPrinterName, which returns the
device name of the current default printer. This last function is
particularly useful for troubleshooting purposes. Neither of
these two functions are available in the 16-bit version due to
differences in their internal implementation.

The 16-bit version uses the Windows API Escape function. Although
the Windows documentation states that this function is considered
obsolete and may not be supported, the alternative,
ExtDeviceMode, is also documented as possibly not being
supported. SoftCircuits' research indicated that Escape is
probably supported by as many drivers as ExtDeviceMode is and so
Escape was used. The main trend away from using Escape would
apply to 32-bit platforms, in which case the 32-bit version
should be used as it does not use the Escape function. Note that
the 16-bit version of vbSendPrnToDefPrinter first determines if
the PASSTHROUGH escape is supported and returns ERR_OPENPRINTER
(3) if it is not.

In any case, Windows was not designed to perform this task. The
closest function provided is called SpoolFile and is plagued with
problems and limitations. The task is also very printer-driver
specific. As a result, the technique that was most likely to work
on most computers was used. But it should be pointed out that
there is no way to be certain that these DLLs will work with all
printers and on all platforms.


16-Bit Declarations
===================

'Return codes
Global Const ERR_NOERROR = 0     'No error
Global Const ERR_DEFPRINTER = 1  'Error obtaining default printer
Global Const ERR_OPENFILE = 2    'Error opening file
Global Const ERR_OPENPRINTER = 3 'Error opening printer
Global Const ERR_PRINT = 4       'Error sending date to printer
Global Const ERR_FILE = 5        'Error reading file

'Function declarations
Declare Function vbSendPrnToDefPrinter Lib "BINPRN16.DLL" (ByVal pFilename As String) As Integer


32-Bit Declarations
===================

'Return codes
Public Const ERR_NOERROR = 0     'No error
Public Const ERR_DEFPRINTER = 1  'Error obtaining default printer
Public Const ERR_OPENFILE = 2    'Error opening file
Public Const ERR_OPENPRINTER = 3 'Error opening printer
Public Const ERR_PRINT = 4       'Error sending date to printer
Public Const ERR_FILE = 5        'Error reading file

'Function declarations
Private Declare Function vbSendPrnToPrinter Lib "BINPRN32.DLL" (ByVal pFilename As String, ByVal pPrinterName As String) As Integer
Private Declare Function vbGetDefPrinterName Lib "BINPRN32.DLL" (ByVal pPrinterName As String) As Integer
Private Declare Function vbSendPrnToDefPrinter Lib "BINPRN32.DLL" (ByVal pFilename As String) As Integer
