Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Printing with ??? in VFP?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00510398
Message ID:
00511850
Views:
18
>Hello,
>
>We have a legacy DOS system. For various reasons, we're trying to recomplie our DOS code in VFP. (I know, it's ugly and not recommended but I don't have time to explain our reasoning.) Anyhow, everything seems to work fine except the use of ??? to send control codes to the printer.
>
>For some reason, the first use of ??? causes a page eject. After that initial ???, all the other uses of ??? work fine.
>
>You can see this from the command window with the following:
>
>set printer to name getprinter() && select your printer
>set printer on
>
>? "This is line 1"
>??? (control code)
>? "This is line 2"
>??? (control code)
>? "This is line 3"
>
>set printer off
>set printer to
>
>In that example, the first line would print, the page would eject and then the next two lines would print ... each line being affected by the preceding printer control code.
>
>Has anyone out there found a way to get ??? to work in VFP or have a clue as to what might be happening?
>
>Thanks for whatever help you can offer!

The problem is that issuing a ??? after starting output using ?/??, which respond to the GDI, will cause Windows to close the existing print stream and open a new one. A few simple solutions exists - either change all your ?/?? to ???, adding the necessary CHR(13) + CHR(10) to the output stream for a ? to force a new line, direct the printer output to a file, and when printing is complete send it to the print port using CopyFile() (see my entry in the FAQ on how to copy a file to a port or UNC), or, if your behavior is consistent that subsequent ??? do not force a page feed, try something like:
set printer to name getprinter()  && select your printer
set printer on

<b>??? ' ' + CHR(8)  && send a space, followed by a backspace</b>
? "This is line 1"
??? (control code)
? "This is line 2"
??? (control code)
? "This is line 3"

set printer off
set printer to
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform