Code:
'------------------------------------------------------------------------------- ' LongPathName '------------------------------------------------------------------------------- $Compile Exe Function LongPathName (ShortFileName As String) Export As String Local lIn As String, lOut As String, lRet As Long, lDir As String, lRep As String lIn = ShortFileName lOut = lIn While -1 lRet = Instr(-1, lIn, "\") lDir = Dir$(LIn,16) If (lDir <> "") And (Len(lIn) > 2) Then lRep = Mid$ (lIn,lRet +1) Replace lRep With lDir In lOut Else Function = lOut Exit Function End If lIn = Left$(lIn, lRet -1) Wend End Function Function WinMain (ByVal CurInst As Long, _ ByVal PrvInst As Long, _ CmdLine As Asciiz Ptr, _ ByVal CmdShow As Long) Export As Long 'Example used: c:\program files\common files\microsoft shared\verylongname.tst MsgBox LongPathName ("c:\progra~1\common~1\micros~1\verylo~1.tst") End Function
Peter.
mailto

Leave a comment: