Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I determine the current windows printer?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00163231
Message ID:
00163237
Vues:
24
>I am trying to find out what the currently selected Windows printer is. I have looked at many functions from aprinters(), getprinter(), sys(1037), sys(6), etc...
>
>These will basically call up the prompt dialog, or give you a listing of all possible choices of installed printers.
>
>This may require an API call to determine this value. Anyone have experience with this I would appreciate the input.
>
>
>TIA

Are you talking about the current windows printer or the current printer that VFP is printing to?

The current windows printer is SET('PRINTER',2) and VFP6's SET('PRINTER',3).
For VFP5 the current VFP printer can be found via some trickery:

1) Create a dummy cursor file

CREATE CURSOR x (x C(1))

2) Create a "quick report" from that cursor

CREATE REPORT x FROM x

3) Now open the X.FRX report as a table. The first records EXPR field contains info about the current printer that VFP is printing to. The DEVICE= line will have the name of the printer.

USE x.frx
? x.expr

4) CLOSE and ERASE the dummy tables/reports. The cursor will erase itself when closed, but the report needs to be erased.

USE
ERASE x.frx
ERASE x.frt
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform