G
Guest
In the following function, after adding the filename to the path, the
filename is not there. Even if I try to add the filename in the calling sub
or function, the filename is not there.
While debugging, I notice that the tooltip that shows the value for "out"
does not have a trailing quotation mark. I don't know why and I can't figure
out how to successfully concat the path and the filename!!
Can anyone help???
Thanks in advance!
Public Declare Function WNetGetConnection Lib "mpr.dll" Alias _
"WNetGetConnectionA" (ByVal lpszLocalName As String, _
ByVal lpszRemoteName As String, ByRef cbRemoteName As Integer)
As Integer
Private Function GetUNCPathFromMappedDriveLetter(ByVal MappedLetter As
String, ByVal Filename As String) As String
Try
'MappedLetter arg must be of form "C:"
'get the UNC path and return it
Dim ret As Integer
Dim out As String = New String(" "c, 260)
Dim len As Integer = 260
ret = WNetGetConnection(MappedLetter, out, len)
out = out.TrimEnd(" "c)
Return out & Filename '<--------------Filename is not returned!!??
'Return String.Concat(out,filename) 'also does not work
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Function
filename is not there. Even if I try to add the filename in the calling sub
or function, the filename is not there.
While debugging, I notice that the tooltip that shows the value for "out"
does not have a trailing quotation mark. I don't know why and I can't figure
out how to successfully concat the path and the filename!!
Can anyone help???
Thanks in advance!
Public Declare Function WNetGetConnection Lib "mpr.dll" Alias _
"WNetGetConnectionA" (ByVal lpszLocalName As String, _
ByVal lpszRemoteName As String, ByRef cbRemoteName As Integer)
As Integer
Private Function GetUNCPathFromMappedDriveLetter(ByVal MappedLetter As
String, ByVal Filename As String) As String
Try
'MappedLetter arg must be of form "C:"
'get the UNC path and return it
Dim ret As Integer
Dim out As String = New String(" "c, 260)
Dim len As Integer = 260
ret = WNetGetConnection(MappedLetter, out, len)
out = out.TrimEnd(" "c)
Return out & Filename '<--------------Filename is not returned!!??
'Return String.Concat(out,filename) 'also does not work
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Function