Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing to lpt1 or lpt2 1

Status
Not open for further replies.

tkee

Programmer
Feb 6, 2004
55
US
I started working on a test project in anticipation of a new networked printer being used on a legacy application instead of a local printer, thinking it would be a complete no brainer. In testing, I "set printer to lpt1" on my pc which has a local printer. It still sent my print jobs to my default printer, a network printer. I rebooted just to make sure there wasn't something strange going on, which did not help. Then I made the local printer my default and ran "net use lpt2 \\..." to remap the network printer to lpt2. When I sent print jobs to lpt2 it still sent jobs to the default printer (now the local printer.) I tried sending a report, a list, and even copy file to lpt2. Then I went to a dos prompt and ran "copy filename lpt2:" and it worked exactly as it was supposed to. Are there any foxpro settings somewhere that could be off? What else can I look for? A note: when I used sys(6) it showed my current path along with lpt# at the end. If I set print to again sys(6)showed PRN. I used lpt in both caps and lower case and with and without a colon just in case it would make a difference. This was supposed to be a simple update so users could print checks from their desks instead of from a dedicated PC. I have done similar things in the past with no problem. What am I missing?
 
For FoxPro DOS, you need to do the NET USE command with the PERSISTENT parameter from a command prompt BEFORE running the Fox app.

For example:
NET USE LPT1: \\servername\printername /persistent:yes

If it's Foxpro Windows, add the printer like normal, then any time you want to use that printer, set it as the Windows default printer. You can then just do REPORT FORM ... TO PRINTER and it should go to it.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Hello Everyone,

I am currently using foxpro 2.6 dos version and I need help to add invoice number in my .prg file. Could anyone help me. I really appreciated any inputs from anyone.

Thanks.

Ed
 
Thanks, DSummZZZ for your reply. I have used the correct syntax for net use. It works properly except in FoxPro for Windows. In the code I "set printer to lpt2", but it doesn't. I don't want them to have to choose a different printer every time they print a check and then have to change it back.
 
You may be able to leave the printer definition in the report file, or maybe this method will help you:

But you won't be able to set it to a particular lpt port unles you use ??? commands to print directly to that device. You will have to set it to a defined printer name if you're to run a defined report.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Of the DOS world languages I have most recently used dBase 5 for DOS. This works for LPT2 in dBase5. I don't recall why LPT1 isnm't used, but you can try this to see if it works in old FoxPro:

Code:
NET USE LPT2 /DELETE > MyJunkMsgs.TXT  && clears any prior connection first, users generally don't need the command line respnse displayed
NET USE LPT2 \\ServerName\PrinterName
SET PRINTER TO LPT2
* PRINT JOB *
SET PRINTER TO

It may or may not work in FoxPro, they *are* different languages after all.
 
Oh, FoxPro for Windows was an awkward hybrid with a foot in both worlds, DOS FoxPro underneath with a basic Windows layer on top for printing and screens. Hmm, then I don't have any more to add at this time and leave it at that.
 
Thanks for the help. Looking back I realized that when net use worked before I was using @ says or ??, not reports. I tried the Microsoft link and was able to change the default printer, but I need to change it back and am not sure which was each of their specific default printers to begin with. Also my FoxPro printed to the new default printer but my other apps still printed to the original one, and in the Printer dialog box none of the printers showed the default printer check mark, which made me a little uncomfortable with it. Currently I am just adding a prompt to select the printer. It's not as good as I would like, but better than what they had before. Hopefully some day I'll be able to upgrade their app to VFP as I have done a couple of others. After 20-some years of patches and upgrades it is time for a complete rewrite but this one is a monster. This experience has given me a new appreciation of being able to use named printers, see what your default printer is, etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top