Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get printer network name using API for copyfile api
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00883676
Message ID:
00883683
Vues:
12
>I am using copyfile api to send a file to a printer and it works great. However, I noticed today that it requires not the windows printer name (as we retrieve using getprinter() in vfp) but the sharename. Now I will have to determine if the printer is local or network and if network determine its network name. Is there a simple way to do this? I have many printername retrieval functions but none that I've found so far will return the sharename for a network printer based on its windows name on the workstation...
>
>For instance if I use SET PRINTER TO NAME GETPRINTER() then SET('PRINTER',3) will have the windows name whether it is local or not and if it is a network printer it will not contain the network name. I need to somehow get the network name of the printer so I can pass it to copyfile...
>
>TIA,

Tracy,

Doesn't APRINTERS() give you both?

If the is WSH OK and the above doesn't work then
oNet = CREATEOBJECT('WScript.Network')
oPrinters = oNet.EnumPrinterConnections
The even numbered items, beginning with zero, has the port. In the case of network printers, this will be the name I think you might need.
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