'Retrieving the Short Path Name
'Declarations
'Copy this code into the declarations section of your project.
Declare Function GetShortPathName Lib "kernel32" Alias _
"GetShortPathNameA" (ByVal lpszLongPath As String, ByVal _
lpszShortPath As String, ByVal lBuffer As Long) As Long
'Code
'Copy this function into your project.
Public Function GetShortPath(strFileName As String) _
As String
Dim lngRes As Long
Dim strPath As String
strPath = String$(165, 0)
lngRes = GetShortPathName(strFileName, strPath, 164)
GetShortPath = Left$(strPath, lngRes)
End Function
'Use
An example of use:
Dim StrShortPath As String
StrShortPath = GetShortPath( "c:\dir\this is long.doc")
StrShortPath is now Set to "c:\dir\thisis~1.doc"
Copyright By AccessVision
|