Private Declare Function OSGetLongPathName Lib "STKIT432.DLL" Alias "GetLongPathName" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
Private Declare Function OSGetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
'Funkce: GetLongPath(ByVal strShortPath As String) As String
'Popis: vracφ dlouhΘ jmΘno souboru
'Parametry: krßtkΘ jmΘno souboru
Function GetLongPathName(ByVal strShortPath As String) As String
Dim strLongPath As String * 300
Dim ok As Long
On Error GoTo 0
ok = OSGetLongPathName(strShortPath, strLongPath, 300)
If ok = 0 Then
Error 53 'soubor nenalezen
Else
GetLongPathName = StripNull(strLongPath)
End If
End Function
'Funkce: GetShortPath(ByVal strLongPath As String) As String
'Popis: vracφ krßtkΘ jmΘno souboru
'Parametry: dlouhΘ jmΘno souboru
Function GetShortPathName(ByVal strLongPath As String) As String
Dim strShortPath As String * 300
Dim ok As Long
On Error GoTo 0
ok = OSGetShortPathName(strLongPath, strShortPath, 300)
If ok = 0 Then
Error 53 'soubor nenalezen
Else
GetShortPathName = StripNull(strShortPath)
End If
End Function
'Funkce: StripNull(ByVal WhatStr As String) As String
'Popis: vracφ °et∞zec bez znak∙ NULL na konci °ßdku
'Parametry: °et∞zec, ze kterΘho mß b²t NULL odstran∞no
Function StripNull(ByVal strWhat As String) As String