i'm trying to get the short file path in vb.net
i found a api to do that but the function only works in vb6 can some body help me plz.
Code: Select all
Declare Function GetShortPathName Lib "kernel32" Alias _
"GetShortPathNameA" (ByVal lpszLongPath As String, ByVal _
lpszShortPath As String, ByVal cchBuffer As Long) As Long
Private Sub Command1_Click()
Dim sFile As String, sShortFile As String * 67
Dim lRet As Long
CommonDialog1.ShowOpen
sFile = CommonDialog1.filename
lRet = GetShortPathName(sFile, sShortFile, Len(sShortFile))
sFile = Left(sShortFile, lRet)
Text1.Text = sFile
End Sub