/* VBPRNT32.DLL v2.0 Last Updated 05-29-1996 by Robert Simpson
This version designed for 32-bit Windows apps
NOTES
This version is designed specifically for 32-bit operation, using the
expanded DEVMODE structure in Windows 95.
The sample programs, DLL files and all source code have been released
to the public domain.
This DLL was written and compiled in Borland C++ 4.5
*/
#include <windows.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <dos.h>
#include <ole2.h>
#ifdef WIN16
#include <print.h>
#include <olenls.h>
#include <variant.h>
#include <compobj.h>
#include <dispatch.h>
#endif
/* Exported Functions are listed below, here are the proper VB declares:
Declare Function VBGetPrinters Lib "vbprnt32.dll" () As String
Declare Function VBGetDriverFromName Lib "vbprnt32.dll" (printername As String) As String
Declare Function VBSetDefPrinter Lib "vbprnt32.dll" (printername As String) As Integer
Declare Function VBGetDefPrinter Lib "vbprnt32.dll" () As String
Declare Function VBExtDeviceMode Lib "vbprnt32.dll" (ByVal hWnd As Integer, printername As String, inDev As DEVMODE_TYPE, outDev As DEVMODE_TYPE, ByVal fMode As Integer) As Integer
Declare Function VBDevModeToStr Lib "vbprnt32.dll" (inDev As DEVMODE_TYPE) As String
Declare Function VBStrToDevMode Lib "vbprnt32.dll" (dmString As String, outDev As DEVMODE_TYPE) As Integer
Declare Function VBDeviceCapabilities Lib "vbprnt32.dll" (printername As String, ByVal iCap As Integer, lpStr As Any, inDev As DEVMODE_TYPE) As Long
Declare Function VBResetDC Lib "vbprnt32.dll" (ByVal hDC As Integer, outDev As DEVMODE_TYPE) As Integer
' Here is the VB DEVMODE that should be used in all calls to this DLL requiring a DEVMODE structure:
Type DEVMODE_TYPE
dmDeviceName As String * 32
dmSpecVersion As Integer
dmDriverVersion As Integer
dmSize As Integer
dmDriverExtra As Integer
dmFields As Long
dmOrientation As Integer
dmPaperSize As Integer
dmPaperLength As Integer
dmPaperWidth As Integer
dmScale As Integer
dmCopies As Integer
dmDefaultSource As Integer
dmPrintQuality As Integer
dmColor As Integer
dmDuplex As Integer
dmYResolution As Integer
dmTTOption As Integer
dmCollate As Integer
dmFormName As String * 32
dmLogPixels As Integer
dmBitsPerPel As Long
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
dmPrivate As String
End Type
' The DEVMODE_TYPE structure in VB is essentially a base DEVMODE structure with a dynamic
' string attached to the end (the C version is directly below, named VBDEVMODE) which
' holds the printer's private data (if there is any).
*/
#define PRINTERLIST 2048 // Size of the buffer that holds the available printers
#ifdef WIN32
#define CCONV _stdcall
#else
#define CCONV FAR PASCAL _export
#endif
struct VBDEVMODE // The C equivilent to the VB DEVMODE_TYPE structure above
{
DEVMODE dm; // The size of the DEVMODE structure is larger in Win95 than in Win31
BSTR *dmPrivate; // To compensate for size differences, this dmPrivate area holds the extra data
}; // required by Win95 and by the specific printer driver (if it DOES require anything).