Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting DOS 'safe' path names from a Win path
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00129210
Message ID:
00129262
Vues:
25
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform