Can anyone tell me how to get my HP USB printer to work with VB6. I have an
old app that works great when using printers connected to the parallel port
(LPT1). There doesn't seem to be any useful info in MSDN help. I've tried using
the Printer object but to no avail. Thanks for any and all help.
Jim
"JimB417" <jim...@aol.com> wrote in message
news:20010727173444...@ng-fb1.aol.com...
what exactly is the problem? How does your old application print?
Sounds like it prints directly to LPT1:
VB6 uses the Windows printer model, which means it doesn't matter what
physical port the hardware is connected to - it's the driver's
business to know where to print to, your app shouldn't care for it.
But you have to use the printer object to get these benefits. Directly
printing to LPT1 means, the app doesn't use the driver and therefore
cannot access USB printers. Sounds like a case of bad programming.
Good luck,
Guido.
It sounds like your old "app" is as daft as a brush and expects all printers
to be connected to LPT1. How sad! Write another app that does the job
properly. The VB Printer Object will work fine with all printers, however
they are attached.
Mike
"JimB417" <jim...@aol.com> wrote in message
news:20010727173444...@ng-fb1.aol.com...
That's what it does alright, the code in question is in part:
Open "LPT1" for Output as #1
For intX = 1 to 25
Print #1: Data(intX)
....
etc.
Is there any way to make this work with
USB or is this a lost cause.
P.S. your right this is not good programming, but it was written in VB3
and I have been away from VB programming for some time and I'm just
getting back into the game. Thanks for your help.
Jim
Open Printer.Port for Output as 1
For IntX = 1 to 25
Print #1 . . . . .
etc
etc
Mike
"JimB417" <jim...@aol.com> wrote in message
news:20010727235126...@ng-dd1.aol.com...
"Michael Williams" <Mi...@peetsmill.freeserve.co.uk> wrote in message
news:9jtfk4$v1e$1...@newsg2.svr.pol.co.uk...
> I think you really should use the standard VB Printer Object methods or,
> alternatively, the various API printing functions. What is it, exactly,
that
> requires you to print directly to LPT1? . . .
CommonDialog1.CancelError = True
On Error GoTo ErrHandler 'This happens when user clicks "Cancel"
CommonDialog1.ShowPrinter
nc = CommonDialog1.Copies
For i = 0 To Printer.FontCount - 1 'I want to print in a monospaced
font...
If InStr(Printer.Fonts(i), "Fixedsys") Or InStr(Printer.Fonts(i),
"Terminal") Or _
InStr(Printer.Fonts(i), "Letter Gothic") Then
Printer.Font = Printer.Fonts(i)
Exit For
End If
Next
Printer.FontSize = 12
Printer.FontBold = True
Printer.FontUnderline = True
Printer.FontItalic = False
x$ = "lotsa stuff to print"
for i=1 to nc 'how many copies you need?
Printer.Print x$
printer.EndDoc
next
>Here's my printer code...works great for my Laserjet (LPT1) and my Xerox
>(USB1)
>
>CommonDialog1.CancelError = True
> On Error GoTo ErrHandler 'This happens when user clicks "Cancel"
> CommonDialog1.ShowPrinter
> nc = CommonDialog1.Copies
>
> For i = 0 To Printer.FontCount - 1 'I want to print in a monospaced
>font...
> If InStr(Printer.Fonts(i), "Fixedsys") Or InStr(Printer.Fonts(i
Thanks, guys and to Michael and Larry for all your help. I will give your ideas
a whirl.
Jim
this will never work with USB devices.
You have to redesign your program for use with the windows printer
driver, like replacing your "Print #1" - statements with Printer.Print
and such.
By the way, there could be another problem with modern printers even
if they were connected to LPT1: Cheap printers are GDI printers, which
means the printer is dumb as a nut and all printing is actually done
by the windows driver. The driver renders complete pages and gives
them to the printer. Printing directly to the printer port doesn't
print too much on these printers.
Good luck,
Guido.
On 28 Jul 2001 03:51:26 GMT, jim...@aol.com (JimB417) wrote:
>>...
>
>That's what it does alright, the code in question is in part:
>
>Open "LPT1" for Output as #1
>For intX = 1 to 25
> Print #1: Data(intX)
>....
>etc.
>
>Is there any way to make this work with
>USB or is this a lost cause.
>...
Lots of "not so cheap" printers are, too! Virtually all of the HP DeskJet
range, for example, even the most expensive models.
Mike