Dec 142017
 
DLL for Windows 3.0 to Allow Printer Setup with Visual Basic and Turbo Pascal for Windows, includes source code in Turbo Pascal.
File PSETUP.ZIP from The Programmer’s Corner in
Category Windows 3.X Files
DLL for Windows 3.0 to Allow Printer Setup with Visual Basic and Turbo Pascal for Windows, includes source code in Turbo Pascal.
File Name File Size Zip Size Zip Type
FORM1.FRM 2256 843 deflated
PRSEL.BAS 883 411 deflated
PRSEL.FRM 5093 2180 deflated
PRSEL.MAK 69 53 deflated
PSETUP.DLL 3328 1742 deflated
PSETUP.PAS 2168 767 deflated
README.TXT 4266 1657 deflated

Download File PSETUP.ZIP Here

Contents of the README.TXT file


Though the printer setup dialog box associated with each Windows 3.0
printer driver is normally accessed through the Windows Control
Panel, it is often convenient to allow users to modify printer
settings directly from Visual Basic applications and Turbo Pascal for
Windows For this reason, PSETUP.DLL was created.

Files included with PSETUP.DLL:

README.TXT - This documentation file.

PRSEL.MAK - Visual Basic makefile for the sample application.
PRSEL.BAS - Global variables, types & declarations for sample app.
PRSEL.FRM - Visual Basic form for printer select dialog box.
FORM1.FRM - Visual Basic form calling printer select dialog box.

PSETUP.PAS TPW Source code for PSETUP.DLL
PSETUP.DLL - DLL providing print setup interface.

PSETUP.DLL contains one function (CallPSetup()), called by a Visual
Basic application, that calls the ExtDeviceMode() function located in
all Windows 3.0 printer drivers. The CallPSetup() DLL function
brings up a dialog box displaying printer settings specific to each
printer, and allows the user to modify those settings, saving them to
an .INI file.

The function declaration for CallPSetup() will appear as: (NOTE: the
following declaration is broken into several lines for readability.
In the actual Visual Basic application, it should be on a single
line.)

Declare Function CallPSetup Lib "PSETUP.DLL" (ByVal hWnd%,
ByVal Driv$,
ByVal Dev$,
ByVal Port$,
ByVal INI$) As Integer

Where:

hWnd% is the calling form's window handle. ie: Form1.hWnd.

Driv$ should be a variable-length string containing the print driver
filename ie: "HPPCL.DRV" Note: this can be obtained from the WIN.INI
file via the API calls GetProfileString() or
GetPrivateProfileString() and, since this is a filename, the .DRV
extension must be added to the end of the name.

Dev$ should be a variable-length string containing the device name of
the printer ie: "PCL / HP LaserJet" (Also available from the WIN.INI
file.)

Port$ should be a variable-length string containing the actual
printer port name for print driver to send output to ie: "LPT1:"
(Available from the WIN.INI file.)

INI$ should be a variable-length string set to the name of the .INI
file to be modified by CallPSetup(). (Should normally be set to
"WIN.INI". If though, your application has it's own .INI file
associated with it, INI$ should be set to the name of your custom
.INI file.

RETURNS: An integer value indicating the success of the CallPSetup()
function. If the OK button was pressed to exit the setup dialog box,
a value IDOK (1) will be returned. If the CANCEL button was pressed,
a value IDCANCEL (2) will be returned. If the dialog failed to open,
a value less than zero will be returned.

Using the sample application:

To use the sample application provided (PRSEL),Copy the files

to a directory on your hard disk and copy PSETUP.DLL to
your WINDOWS directory. Then, start up Visual Basic and open the
project PRSEL.MAK. From here, run the application (press F5). To
access the printer selection dialog, select Printer Setup... from the
application's file menu. This will display a dialog box containing a
list of available printer drivers (as found in the WIN.INI file) with
the current default printer highlighted. At this point, there are
four options:

* Select a printer via the listbox.

* Choose the Setup button to bring up the print setup dialog box for
the currently selected printer driver.

* Choose the Cancel button to abort any new printer selections and
return to the calling form. Note: any changes made from the print
setup dialog specific to each printer will be saved regardless of
whether Cancel or OK are pressed.

* Choose the OK button to save the new default printer to the WIN.INI
file.


References:

PSETUP.DLL is written in Turbo Pascal for Windows, and the source code is
provided in PSETUP.PAS. Advanced programmers can optionally modify and
rebuild PSETUP.DLL by using Turbo Pascal for Windows.



 December 14, 2017  Add comments

Leave a Reply