Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing the default Windows printer from VFP
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00485503
Message ID:
00485841
Vues:
10
>George
>
>Tried the code VFUG - worked fine.
>
>However I need to select the Eltron printer from a long list of printers on the network before setting it as the default eg
>
>clear
>onet=createobject("WScript.Network")
>lcdefault=SET("PRINTER",2)
>store getprinter() to rpr
>onet.setdefaultprinter(rpr)
>set printer on
>FOR X=1 TO 10
>? "aaaaaaaa!"
>NEXT
>SET PRINTER OFF
>SET PRINTER TO
>onet.setdefaultprinter(LCDEFAULT)
>
>However the getprinter command fouls up the works and although the default printer is changed, I cant print anything to it. In fact I have to come out of VFP to rectify the situation. Any ideas.
>
>Thanks a lot.
>
>
Colin,

I just tried the following and it worked
lcdefault = SET('PRINTER', 2)
lcnew = GETPRINTER() && Selected a generic printer
oNet = CREATEOBJECT('WScript.Network')
oNet.SetDefaultPrinter(lcnew)
? SET('PRINTER', 2) && Shows selected generic printer
oNet.SetDefaultPrinter(lcdefault)
? SET('PRINTER', 2) && Shows original printer
Not knowing the details of how you're trying to print, leaves me a bit in the dark, however, it's been my experience that if the report output is set to the default printer, the above works correctly.
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform