Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GETFILE() Mapped Drives
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01038586
Message ID:
01038591
Views:
16
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--
Previous
Reply
Map
View

Click here to load this message in the networking platform