Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Capturing
Message
 
À
18/10/2001 16:40:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00570528
Message ID:
00570535
Vues:
18
>Can anyone tell me how I can find out what is the current mapping of F: drive or any drive?

With Windows Script Host:
FUNCTION DriveShare
PARAMETERS tcDrive
LOCAL oWshNetwork, oDrives, llRetVal, lcDrive

* Make sure the drive letter is uppercase
lcDrive = UPPER( tcDrive )

* Make sure there is a : on the drive letter
IF LEN( lcDrive ) = 1
	lcDrive = lcDrive + ":"
ENDIF

llRetVal = SPACE( 0 )

* Create the network object
oWshNetwork = CreateObject("WScript.Network")

* Get a list of the drives mapped
oDrives = oWshNetwork.EnumNetworkDrives( )

* Look for the specified drive
FOR i = 0 TO oDrives.COUNT - 1
	IF oDrives.Item(i) = lcDrive
		* Return the drives share
		llRetVal = oDrives.Item(i+1)
	ENDIF
ENDFOR

* Pickup your socks
oWshNetwork = NULL
oDrives = NULL
RELE oWshNetwork
RELE oDrives

RETURN llRetVal
HTH,
John
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform