Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Printer settings at run-time
Message
From
11/03/1999 03:08:40
Walter Meester
HoogkarspelNetherlands
 
 
To
10/03/1999 21:58:52
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00189772
Message ID:
00196242
Views:
33
Forio,

>Well, OK again, so I copy the report file to a temporary file, and manipulate the EXPR, TAG and TAG2 fields, changing the printer name to the desired one.

>This is sort of working, but I know that the actual printing is not going to be all right ALL OF THE TIME, because of differences in parameters between printer drivers.

When you clear the EXPR, TAG and TAG2 settings and set the printer with the SET PRINTER TO NAME command it should work fine because then it uses the default document properties for this printer.

one alternative but more complex route is to set the disired printer, create a quick report for a dummy table (with the CREATE REPORT report FROM Dummy), and copy the EXPR, TAG, TAG2 to your report. Optionally, you can change some of the document properties bij using the DocumentProperties API call and store the DEVMODE structure in the TAG2 fields. The only drawback with this option is that it only works for some (like orientation and papersize) properties. The other properties you set (like color and resolution) are reverted to the default settings.

>I figure you could use some API call to change the Windows Current Printer to another and then back to what it was, but I am not conversant with the API, nor I have access to MFC.

This can be done with one or more API calls. I don't remember the exact code, but i'm sure you can find this either here in the UT or the MS KB. Alhough this is a possibility i would not recommend this. If your program crashes before the printing ends (which is quite common because of some printer driver related problems), your default printer would be changed.
Previous
Reply
Map
View

Click here to load this message in the networking platform