Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
STRTOFILE writes to file with printer name
Message
De
05/09/2001 13:06:18
 
 
À
05/09/2001 10:57:50
Patrick O'Neil
American Specialty Information Services
Roanoke, Indiana, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00552012
Message ID:
00552655
Vues:
13
>ed -
>
>thanks for your recommendations. i'll be trying those classes.
>
>my real and original object was to be able to open and print a text
>file from VFP. i could not find an app like notepad or wordpad
>that is an OLE server. (maybe i didn't look hard enough or didn't
>look in the right place).
>

If the file ends in a .TXT extension, then either NotePad, WordPad or MS Word will be used as the Windows file handler for ShellExecute(); you could invoke the ShellExecute() API call with the PRINT command instead of the default OPEN command, and whichever app is designated as the server in the File Type entries in the registry will be invoked automagically. There's a class in the FFC which serves as a wrapper for ShellExecute, called _ShellExecute, in the _environ.vcx classlib in the FFC subfolder of VFP, and sample code for using the API call directly in the WinAPI section here on UT.

>what i ended up doing in the meantime, was to create a table called
>TEXTBL with 1 field called io_line C(100). i fopened the text file and
>read each line with FGETS, appending each line as a record to TEXTBL.
>
>then just did REPORT FORM rpt_TXTRPT TO PRINTER PROMPT NOCONSOLE, where
>the report rpt_TXTRPT just has a detail line with one full-width field
>for io_line. (no grouping, labels, headers, or footers).
>

You could simply invoke a DirectPrintOutput instance and write directly to the spooler using DocWrite(), or use the SpoolFile() method to queue up an instance of the text file in the spooler. This is exactly what the class is designed to do. It bypasses the GDI, so whatever is written to the spooler is not reinterpreted by the GDI layer of Windows - this means you are responsible for any printer control sequences and the like you need in your output. The spooler will not add things like page feeds or reinitialize the printer before sending your stuff; it's a pure raw write.

>crude, but simple. talk about going around the barn 3 times to get in
>the door.

The class should handle this directly; ShellExecute() will invoke the file type application for printing, but it will likely go through the GDI and use the default font for text files set in the application.
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform