QBasic / QB64 Discussion Forum      Other Subforums, Links and Downloads

 Return to Index  

USB printing with LPRINT in XP or NT

September 14 2008 at 11:52 AM
Clippy  (Login burger2227)

Response to how to use lprint in windows xp


The following program will try to set your USB printer up for LPRINT. First you must Share the Printer in a Network. Goto Control Panel and select the USB printer to use and R Click Properties. On the Share Tab just click share and Windows will create a Printer Share Name.

Then Click the Advanced Tab and click the Print Processor button. A Window will come up telling you the present setting. If it is NOT Text then change it to Text. Remember your old setting!

Then run the following Qbasic routine. It uses the NET VIEW and NET USE command options to allow data sent to LPT1 by LPRINT to be routed to the USB printer:

COLOR 11: LOCATE 2, 20: PRINT "XP USB Printer to assign for LPRINT"
COLOR 10: LOCATE 3, 4: PRINT "In Control Panel, set the USB printer to Share with Text Format (not RAW)."
SHELL "NET VIEW " + Computer$
COLOR 14: INPUT "        Enter the USB Printer's Share Name from above: ", Printer$
SHELL "NET USE LPT1 \\" + Computer$ + "\" + Printer$  'transfer from LPT1 to USB
LPRINT "Test of USB Printer use with LPRINT." + CHR$(10)  'line feed
LPRINT CHR$(12)  'form feed
SYSTEM  'end of routine

'NOTE! You only have to run this once! You may have to reset the Print Processor Text setting for other Windows uses.

To CANCEL the settings use the code below with the variables from above:

SHELL "NET USE LPT1 \\" + Computer$ + "\" + Printer$ + " /Delete"

This XP hint was contributed by QBGuy in the main Forum.


This message has been edited by burger2227 on Dec 5, 2009 5:30 PM

 Respond to this message   
 Copyright © 1999-2018 Network54. All rights reserved.   Terms of Use   Privacy Statement