|
Here's a code snippet to retrieve the old dos filenames from the Win95 or Win98 Long filenames. Occasionally, you may need this function. For example: C:\MyLongestPath\MyLongerPath\MyFilename.txt would return as C:\Mylong~1\MyLong~2\Myfile~1.txt Put the declaration in a .bas module
Declare Function GetShortPathName Lib "kernel32" Alias _
"GetShortPathNameA" (ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
Next comes the function:
(Place in a module)
Private Function GetDosPath(LongPath As String) As String
Dim s As String
Dim i As Long
Dim PathLength As Long
i = Len(LongPath) + 1
s = String(i, 0)
PathLength = GetShortPathName(LongPath, s, i)
GetDosPath = Left$(s, PathLength)
End Function
Lastly call it like this:
DosPathName = GetDosPath(Long Path Goes in here)
Hope you find this useful. Sincerely,
|
Quick searches: Site Search | Advanced Site Search |
|
By using this site you agree to its terms and conditions VB Explorer and VBExplorer.com are trademarks of Exhedra Solutions, Inc. |