Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to use GetPrinterData?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
00972571
Message ID:
00972817
Vues:
15
Hi Eric,

>I am trying to get the current printer configuration setup by the user at run time in order to keep it and set it back to this particular configuration the next time the user get in this report.

This information is stored in the TAG2 field when the user modifies a report. VFP doesn't update this part when the user merely prints a report.

>I saw something about the api GetPrinterData but it is not very clear to me how to really use that.

All printer settings are context specific in Windows. Whenever a program like VFP wants to print a document, it first acquires a device context. VFP passes this context to the printer dialog that in turn updates the values in the context structure. In order to capture the user's choices, you need access to the printer structure. There are two rather impractical approaches that I can think of:

a) During the course of printing, get a handle to the device context. This requires VFP 9, since VFP 9 - for the first time - gives access to the GDI+ handle. There are API functions to get the device context for a GDI+ function and functions to get the settings for a particular device context. I'm not sure, though, if there are all the required pieces, or if something is still missing.

b) Display your own printer dialog. Then update EXPR, TAG and TAG2 in the FRXD file (you have to figure out the format first) and print the report in VFP without PROMPT clause.

Both "solutions" seem to be a lot of work compared to letting the user modify the report and make the choice explicetly.
--
Christof
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform