Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GETFILE() Mapped Drives
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01038586
Message ID:
01038591
Vues:
17
This message has been marked as the solution to the initial question of the thread.
>I want users to select files using the GETFILE() command.
>
>Some users have shares mapped as drive letters such "\\Server\Share1" = "X:"
>
>I would like to store the file name in table so that other users who may not have the same mapped drives can access it. Is there a way to force GETFILE() to return the UNC name instead of the mapped drive?
FUNCTION _LocalName2UNC
PARAMETERS tcLocalName
LOCAL lcUNCBuffer, lnLength, lcLocalName
DECLARE INTEGER WNetGetConnection IN WIN32API ;
   STRING @ lpLocalName, ;
   STRING @ lpRemoteName, ;
   INTEGER @ lplnLength
   
   
IF EMPTY(tcLocalName) OR TYPE('tcLocalName') <> "C"
	ERROR 11
ENDIF

lcLocalName = ALLTRIM(tcLocalName)

IF LEN(lcLocalName) = 1
	lcLocalName = lcLocalName + ":"
ENDIF
lcUNCBuffer = REPL(CHR(0),261)
lnLength = LEN(lcUNCBuffer)
IF WNetGetConnection(lcLocalName, @lcUNCBuffer, @lnLength) = 0
   lcRemoteName = LEFT(lcUNCBuffer,AT(CHR(0),lcUNCBuffer)-1)
ELSE   
	lcRemoteName = ""
ENDIF

RETURN lcRemoteName 
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform