August 2012
I have an IMP-24 printer with a Centronics interface. I would like to print to it from a Windows 7 or XP computer using some form of Basic. I have VB and Visual Studio 2010 Ultimate. However, there seems to be no drivers for this old printer. Is there a way to address LPT1 from Visual Basic or Visual C so I can send the data to the printer directly without going through the operating system?
Please log in to post an answer.
Here is one method that I think will work for you, but I don't know how it will handle control characters. It's fairly quick to set up, though.
On XP:
- click Start
- point to Settings, then click on Printers and Faxes
- double-click on Add Printer
- click on Next
- click on Local Printer
- select Local Printer Attached to this Computer
- click on Next
- let it search, it will come up with "The Wizard was unable ..."
- click on Next
- select the LPT port you want to use
- click on Next
- from the left column, select Generic
- then from the right column, select Generic / Text Only
- click on Next
- if you desire, change the printer name
- select whether or not you want this to be the default printer
- click on Next
- select whether or not you want to share this printer on your network
- select No for printing a test page
It will now show you your selections.
If it looks ok, select finish.
It will show that it's copying some files and then the window will disappear indicating that it is complete.
To cause Windows to NOT spool the printer output:
- Right click on the printer you just created
- click on the advanced tab
- select Print directly to printer
- click Apply, click OK
(The following code is from a VB6 app that I wrote that was using an HP printer with an HP driver.)
In VB there is a Printer object.
'It needs some setup code:
'Printer defaults
With Printer
ColorMode = vbPRCMMonochrome
.Copies = 1
.Orientation = vbPRORPortrait
.Zoom = 100
.ScaleMode = vbTwips
.FontBold = False
.FontItalic = False
.FontStrikethru = False
.FontTransparent = True
.FontUnderline = False
.FontName = "Courier New" 'not proportional letters
.Orientation = vbPRORPortrait
.ScaleMode = vbInches
.FontItalic = False
.FontBold = False
'You may not need the following:
.FontSize =
If .PaperSize <> 1 And .PaperSize <> 9 Then
.PaperSize = 1
End If
'sets top, left of page
Printer.CurrentY = 0
Printer.CurrentX = 0
'end of May Not Need
' Here's where you actually print the text"
Printer.Print strStringOfText
' note: If you want to print more on the same line,
' add a trailing semicolon for all but the last print
Printer.Print strStringOfText;
Printer.NewPage 'ie: formfeed
'If your printer is spooling, the following will cause the document to print.
'It will also signal End of Document so you can start the next document
Printer.EndDoc