I tried that statement, but it did not recognize the command "net". Also the Pascal program seems to bomb when I use any value other than 'USB001' in the call to InitPrinter (or when I omit InitPrinter). The printer is connected directly to my computer by a USB cable. There is no local net.
Date: Thurs, Dec 17 2009 5:00 am From: "Zaphod Beeblebrox"
"SirJohn" contestcen@aol.com wrote in message news:dff19abd-9e4d-40c0-a4cb-d7aa8b66e7a3@j14g2000yqm.googlegroups.com...
I just moved to Windows 7, which means that I now connect to my printer via a USB port instead of a serial port. In those FPC programs which use the printer I changed InitPrinter('LPT1') to InitPrinter('USB001') however, everything I print is now going to a disk file named USB001 instead of to the printer. What else do I need to get this working?
Make sure the printer is shared, and then use the following command to redirect LPT2 to the printer:
net use LPT2: \computername\printername /persistent:yes
Replace 'computername' with your computer name, and 'printername' with the share name of your printer. After you've run the command, you should be able to use InitPrinter('LPT2') in your program.
BTW, you want to use LPT2 since from what I've read, if the printer port actually exists, Vista and Windows 7 won't let you redirect to it.
Hope this helps.