Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Microsoft: FoxPro FAQ

Program Source Code

Long File name support in Foxprow 2.6a by snix2
Posted: 21 Jan 03

Here's a quick snippet which converts long file name paths to foxpro compatible short file paths. e.g. 'c:\program files' becomes 'c:\progra~1'.

* This function will convert long path names to
* foxpro compatible short path names
* It uses the winapi function 'GetShortPathName'
* And the foxpro FOXTOOLS.FLL library    

set library to sys(2004)+'FOXTOOLS.FLL'

*** Register the windows API function...
GetShort = regfn('GetShortPathName','@C@CI','I')

*** Create a variable for holding the results
Buffer = SPACE(500)

*** Set the longpath variable to be the normal long pathname
*** Example here is c:\program files...
longpath = ALLTRIM(SYS(5)) + '\Program Files'

*** Call the function
Result = callfn(GetShort, @longpath, @buffer, 500)

*** remove the trailing null terminating character (Chr(0))
Buffer = left(buffer, result)

? Buffer

** Now the 'buffer' variable contains an
** untrimmed short path name
** The 'Result' variable holds a number.
** This number is the number of characters long
** that the short file name is.
** Usable by foxpro.

Back to Microsoft: FoxPro FAQ Index
Back to Microsoft: FoxPro Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close