How to convert file path to UNC? 
Author Message
 How to convert file path to UNC?

How do I convert a file path to UNC.  For example, how do I convert
c:\program files\x.txt to \\robertg\c\Program Files\x.txt.
Is there a Win api that does that?
--
Robert Gelb
Senior Systems Analyst
Data Express
Garden Grove, California USA
(714)895-8832



Mon, 17 Jan 2000 03:00:00 GMT  
 How to convert file path to UNC?

Quote:

>How do I convert a file path to UNC.  For example, how do I convert
>c:\program files\x.txt to \\robertg\c\Program Files\x.txt.
>Is there a Win api that does that?

Using the WNetGetConnection, you can get the UNC(?) path of the drive
mapping. Here's a sample in Win-16, that prints the mapping when
selecting a different drive in a drive list box:

Declare Function WNetGetConnection% Lib "User" (ByVal lpLocalName$,
ByVal lpRemoteName$, RemoteNameSize%)
Declare Function GetDriveType% Lib "Kernel" (ByVal nDrive%)

Sub Drive1_Click ()
  Dim driveName As String * 256, ret%, length%
  length = Len(driveName) - 1
  ret = WNetGetConnection(Left$(drive1, InStr(drive1 & ":", ":")),
driveName$, length)
  length = InStr(driveName & Chr$(0), Chr$(0)) - 1
  label2 = drive1 & " " & "Return code = " & CStr(ret) & " , Len = " &
CStr(length)
  label1 = Chr$(34) & Left$(driveName, length) & Chr$(34)
End Sub

HTH,
Bart.



Mon, 17 Jan 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to convert file path to UNC???

2. How to convert file path to UNC???

3. Converting logical paths to UNC paths

4. Help converting UNC paths to physical paths.

5. Converting logical paths to UNC paths

6. How to convert local path to UNC-path?

7. How to convert local path to UNC-path?

8. How to convert path to UNC path?

9. Convert Path to UNC

10. Convert path to UNC

11. Converting a path to its UNC equivalent?

12. convert unc to a local path

 

 
Powered by phpBB® Forum Software