Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Determine UNC Path from a Drive Letter?
Message
De
08/08/2002 11:44:56
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00687141
Message ID:
00687572
Vues:
11
Sorry I can't get this to work. It is the loDrives object that appears to have nothing in it. The loDrives.count reports 2 but I have five (assuming that loDrives.count reports the number of drives). But it errors out on loDrives.item.

Below is my test prg. I changed oDrives to loDrives in your example. I'm running XP and VFP7:

myresult=finddrive("\\homesrv\srv-f")
SET STEP ON
return
FUNCTION FindDrive

LPARAMETER tcUNC && The UNC to find

LOCAL lnlast, lni, loNet, loDrives, lcresult, llfound
lcresult = ""
llfound = .F.

SET STEP ON
loNet = CREATEOBJECT("WScript.Network")
loDrives = loNet.EnumNetworkDrives
lnlast = loDrives.Count
lni = -1
DO WHILE lni < lnlast AND NOT llfound
lni = lni + 2
llfound = (UPPER(tcUNC) = UPPER(loDrives.Item(lni)))
ENDDO
IF llfound
lcresult = loDrive.Item(lni - 1)
ENDIF
RETURN lcresult
John Fabiani
Woodland, CA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform