>Does anybody know of a way to retrieve a safe path from
>long filenames?
>
>I'm running into a number of problems with RUN and long filenames
>that point to \program files\ etc. It's easy enough to fix manually,
>but there's gotta be an API call that does this for you.
>
>c:\program files\html help workshop\hhc.exe
>
>into:
>
>c:\progra~1\HTMLHe~\hhc.exe
>
>Any ideas?
Hi Rick,
The function you need is GetShortPathName(). Here's the declaration and an example call:
DECLARE INTEGER GetShortPathName IN Win32API;
STRING @lpszLongPath, STRING @lpszShortPath,;
INTEGER cchBuffer
lclongname = "C:\WINDOWS\Start Menu\Programs\Visual FoxPro\Visual FoxPro.lnk
lcshortname = SPACE(260)
lnlength = LEN(lcshortname)
lnresult = GetShortPathName(@lclongname, @lcshortname, lnlength)
? LEFT(lcshortname, lnresult)
hth,
George
Ubi caritas et amor, deus ibi est