>FUNCTION Fn2Lfn >LPARAMETERS pcFileName >* FN2LFN = "FileName" To "LongFileName" >* >* AUTHOR: Wgcs.. Function derived from sample code posted by >* AirCon (IS/IT--Manageme) on TekTips.com on May 12, 2003 >* DATE: added LASv10.40, adjusted to convert all parts of the path, May 27, 2003 LASv10.42 >* PURPOSE: converts an 8.3 or an all-uppercase filename into >* it's proper-case long filename. >* REFERENCE: Used by aasApplication.GetFile >* NOTES: If the file isn't found, then the original passed >* filename is returned. > >Declare Long FindFirstFile in Kernel32 as fnFindFirst ; > String cFileName, String @WIN32_DATA >Declare FindClose in Kernel32 as fnFindClose Long hFile >LOCAL lcFile, lcBuffer, lcPath, lcLastPath, lcFullPath > lcFullPath = '' > lcPath = pcFileName > lcLastPath = '' > > do while !(lcPath==lcLastPath) > lcLastPath = lcPath > lcBuffer = replicate(chr(0), 318) > hFile = fnFindFirst(lcPath, @lcBuffer) > If (hFile <= 0) > lcFile = JustFName(lcPath) > else > lcFile = substr(lcBuffer, 45) > lcFile = left(lcFile, at(chr(0), lcFile)-1) > fnFindClose(hFile) > endif > > lcFullPath = iif(Empty(lcFullPath),lcFile,addbs(lcFile)+lcFullPath) > lcPath = JustPath(lcPath) && Remove rightmost file/dir reference > enddo > lcFullPath = AddBS(lcPath)+lcFullpath > > Clear Dlls fnFindFirst, fnFindClose > RETURN lcFullPath >ENDFUNC >