17-10-12, 02:17 PM
كاتب الموضوع : Boutemine Oualid
السلام عليكم و رحمة الله وبركاتهكود :
Private Const NO_ERROR As Long = 0&
Private Declare Function WNetGetConnection Lib "mpr.dll" Alias "WNetGetConnectionA" (ByVal lpszLocalName As String, ByVal lpszRemoteName As String, cbRemoteName As Long) As Long
Function GetUNCPath(ByVal sDrive As String) As String
Dim sBuffer As String
sBuffer = String(255&, vbNullChar)
If WNetGetConnection(sDrive, sBuffer, Len(sBuffer)) = NO_ERROR Then
GetUNCPath = Left$(sBuffer, InStr(1, sBuffer, vbNullChar) - 1)
Else
GetUNCPath = vbNullString
End If
End Function