Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get ShortPathNames from given LongPathNames
Message
From
20/07/2009 04:25:50
 
 
To
20/07/2009 04:09:51
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01413340
Message ID:
01413348
Views:
48
>>>Hi all
>>>
>>>Is it possible to get a ShortPathName for a given Long Path Name?
>>>
>>>C:\PROGRA~1\FOLDERN~1\FILE.EXT
>>>
>>>from the supplied "C:\Program Files\Folder Name\file.ext"
>>>
>>>Thanks and regards.
>>
>>You can use the GetShortPathName() API function:
>>
>>
>>
>>* API:
>>Declare LONG GetShortPathName IN WIN32API STRING, STRING @, LONG
>>LOCAL lcShortName, lcLongName
>>lcShortName = REPLICATE(CHR(0),200)
>>lcLongName = HOME()
>>? GetShortPathName(m.lcLongName,@lcShortName,199), m.lcShortName
>>*!*	? FILE( ADDBS(m.lcShortName) + 'vfp9.exe')
>>
>>* WSH (seems easier but may not always be available):
>>LOCAL loFS as Scripting.FileSystemObject
>>loFS = CREATEOBJECT('Scripting.FileSystemObject')
>>? loFS.GetFolder( HOME() ).ShortPath
>>
>>
>>
>>
>>hth
>>-Stefan
>
>Stefan,
>
>Option 3: Adir()


Good point, thanks! :-)


-Stefan
Previous
Reply
Map
View

Click here to load this message in the networking platform