Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Change Printer
Message
De
27/02/2002 12:11:30
 
 
À
27/02/2002 10:44:29
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Titre:
Divers
Thread ID:
00625774
Message ID:
00625831
Vues:
12
Hi Agnes.

Now I want to set printer in front of report. I figured out that I need to set printer in front of first run because the settings will change the page (lenght)

How about using wscript.network? Just instantiate it in the init of your form like so:
WITH ThisForm
  *** Save the default printer
  .cDefaultprinter = SET( 'PRINTER', 2 )
  *** Set the combo up to point at the current default printer
  .cboPrinters.ListIndex = ASCAN( .cboPrinters.aContents, .cDefaultPrinter, -1, -1, 1, 15 )
  *** Create the WScript.Network object
  .oNet = CREATEOBJECT( 'WScript.Network' )
ENDWITH
You can populate a combo box with an array of available printers using code like this in the combo's init():
*** Get the installed printers into the combo box
APRINTERS( This.aContents )
This.Requery()
Then code like this in the combo's valid:


*** set the default printer to the selected printer
Thisform.oNet.SetDefaultPrinter( This.DisplayValue )


Al that is left is to reset the printer to the original default printer after you print the report.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform