Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to tell what server a drive is mapped to?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00463131
Message ID:
00464405
Vues:
20
Thanks Ed

>>Does anyone know how to tell what server a drive is mapped to?
>>
>>If I have f:\myfiles how do I get the mapping to \\fileserver\files\myfiles
>>
>
>You can use the Win32 API call WNetGetConnection():
>
>
DECLARE INTEGER WNetGetConnection IN WIN32API ;
>   STRING @ lpLocalName, ;
>   STRING @ lpRemoteName, ;
>   INTEGER @ lpnLength
>LOCAL cLocalDevice, cUNCBuffer, nLength
>cLocalDevice = LEFT(FULLPATH(tcPathName),2) + CHR(0)
>cUNCBuffer = REPL(CHR(0),261)
>nLength = LEN(cUNCBuffer)
>IF WNetGetConnection(cLocalDevice, @cUNCBuffer, @nLength) = 0
>   RETURN LEFT(cUNCBuffer,AT(CHR(0),cUNCBuffer)-1)+SUBST(FULLPATH(tcPathName),3)
>ELSE
>   RETURN NULL
>ENDIF
>
>The server is the name between '\\' and the following '\'
For every bug fixed, there is a bigger bug not yet discovered.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform