PDA

Click to See Complete Forum and Search --> : Hellp please with printers


john_murphy
Jan 27th, 2000, 07:00 PM
I have an application that has to print to 2 printers. They are serial printers and I have this working fine useing MSCOMM

The problem is that more than one PC has to print to the printer.

I want to print the stuff using the windows printer drivers but how would I do this.

I have all the stuff on strings and just want to throw these to the printer.

Help please

JorgeLedo
Jan 27th, 2000, 10:20 PM
Are the printers shared ? If yes you can access them by choosing them in a printer dialog box or even directly (by code). If they are not shared I don't know if there is a way to communicate with a remote serial port.

------------------
Jorge Ledo
j_ledo@hotmail.com
Portugal

Aaron Young
Jan 28th, 2000, 09:07 AM
Once you've add the Printers to the Printers Folder in Windows, you can Access them from VB via the Printer Object, ie.
Function SetPrinter(ByVal PrinterName As String) As String
Dim oPRN As Printer
For Each oPRN In Printers
If LCase(oPRN.DeviceName) = LCase(PrinterName) Then
SetPrinter = Printer.DeviceName
Set Printer = oPRN
Exit For
End If
Next
End Function
Use this Function to Set the Printer Object to a Specific Printer, by passing the Name of the Printer, ie.

sOldPrinter = SetPrinter("Generic/Text Only")

The Name of the Current Printer is Returned, so that if need be you can easily restore it by Calling the Function again.

------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
ajyoung@pressenter.com