Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Net Use to map a drive?
Message
De
13/10/1998 19:10:27
 
 
À
13/10/1998 11:18:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00146250
Message ID:
00146441
Vues:
25
>Is there an API to map a Windows NT network drive letter? Similar to the NET USE dos prompt command.

In addition to the API stuff mentioned by others, the Windows Scripting Host (native to 98, and addable to other operating systems by running the self-installing WSH.EXE available from Microsoft's Web site) provides a network automation object. If WSHOM.OCX has been registered, the following works:
oWshNet = CREATEOBJ('Wscript.Network')
*  Lots of arguments available here:
*  cLocalDrive is the local resource name (eg 'N:')
*  cRemoteName is the UNC of the path you want to map
*  (optional)  lUpdateProfile (bool) if .T., save the mapping
*  (optional)  cUserId the name of a user other than the default
*              Windows Login userid for accessing UNC
*  (optional)  cPassword password for user accessing UNC
oWshNet.MapNetworkDrive(cLocalDrive, cRemoteName)
*
*  You can unmap a drive by:
*
oWshNet.RemoveNetworkDrive(cLocalDrive)
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform