Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Any API call to get the Base path from a UNC path?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00180686
Message ID:
00180802
Vues:
26
>>Hi folks,
>>
>>I need to now if there is an API call that can return a base path from a UNC path?
>>
>>ie:
>>
>>UNC path: \\continuum\putz\recon\recon_check.dbf
>>Returning Base path: d:\putz\recon\recon_check.dbf
>>
>>By Base path, I am referring to the actual path in that particular workstation/server.
>
>IOW, you want to know what, if any, local resource points at the UNC? the easiest way to do this would be to use WNetGetConnection() to retrieve the UNC for each drive that's a network drive, and compare the UNC returned to your UNC. It's entirely possible that there's no drive currently mapped to that base UNC, so you'd have to map a drive to find it. Your best bet would be to use the Wscript.Network object to spit out a list of UNCs currently mapped:
>
>
cUNCToTest = '\\Myserver\Myshare\somepath\somefile.xyz'
>oNet = CREATEOBJ('Wscript.Network')
>oUNCCollection = oNet.EnumNetworkDrives
>LOCAL nCtr, cPath
>cPath = ''
>FOR nCtr = 0 TO oUNCCollection.Count - 1
>   IF UPPER(cUNCToTest) = UPPER(oUNCCollection.Item[nCtr + 1])
>      cPath = oUNCCollection.Item[nCtr] + ;
>              SUBST(cUNCToTest,LEN(oUNCCollection.Item[nCtr + 1]) + 1)
>      EXIT
>   ENDIF
>ENDFOR
Ed,

AFAIK, even if you're attached to a particular server, using UNC's doesn't use a device. The DBF() function simply returns \\SERVER\VOLUME\PATH\TABLE.DBF.
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