Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting Dos 8.3 Name
Message
From
26/09/2002 12:55:47
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00704443
Message ID:
00704788
Views:
16
I wonder why it wasn't named 'GETSHORTY()' :o) ? *G*


>>I'm using Getfile() and getting the long windows file name. Is there any function or a way to get the DOS 8.3 short file name given it's full long file name?
>>
>
>You can use the WIndows API function GetShortPathName() as follows:
>
>
DECLARE INTEGER GetShortPathName IN WIN32API ;
>   STRING @ lpszLongPath, ;
>   STRING @ lpszShortPath, ;
>   INTEGER cchBuffer
>
>cShortFormBuffer = REPL(CHR(0),512)
>nLenShortName = GetShortPathName('MyLongPathName',@cShortFormBuffer,511)
>IF nLenShortName # 0
>   cShortName = LEFT(cShortFormBuffer,nLenShortName)
>ELSE
>   * Call GetLastError() for error code
>ENDIF
>
>Or you can use the Scripting.FileSystemObject from the WSH:
>
>
oFSO = CREATEOBJ('Scripting.FileSystemObject')
>oFile = oFSO.GetFile('MyLongFileName')
>? oFile.ShortName
>? oFile.ShortPath
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Reply
Map
View

Click here to load this message in the networking platform