Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I get short path name in VFP?
Message
 
To
16/10/2002 19:06:17
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00711861
Message ID:
00712095
Views:
10
The technique you have given to me which is:
DECLARE INTEGER GetShortPathName IN Win3s2API ;
   STRING  @cLongPath, ;
   STRING  @cShortPathBuff, ;
   INTEGER nBuffSize

lcLongFile = "c:\program files\somefolder\my file name.doc"
lcBuffer = SPACE(511)
lnBufferSize = 511
lnShortPathLen = GetShortPathName(lcLongFile, @lcBuffer, @lnBufferSize)

lcShortPath = LEFT(lcBuffer, lnBufferSize)
does not work, which I hate to admit.

George's technique works only when the file already exists.
Following is a list that describes the logic:

  • 1. Any application can print to this printer;
  • 2. The printer asks my application for an export file name;
  • 3. The printer only accepts short file path and name from my application;
  • 4. My application creates a file name in a sub folder in the current application folder;
  • 5. The path to my application folder may be a long path depending on the user's installation (the user has the freedom to do so);
  • 6. Therefore, when the application is installed in a long path, the application is responsible to convert the long path name to a short one.
  • 7. Therefore, I need a function that converts the long file name to a short one;
  • 8. I found GetShortPathName in WIN32API which suppose to do the trick, only it didn't.

    What I really need is a way to convert the long path/file names to short ones.

    I am very grateful to the helps that I have received. I am going to call it a day.

    Thank you,

    Dawa
    Dawa Tsering


    "Do not let any unwholesome talk come out of your mouths,
    but only what is helpful for building others up according to their needs,
    that it may benefit those who listen."

    - Ephesians 4:29-30 NIV

    Dare to Question -- Care to Answer

    Time is like water in a sponge, as long as you are willing you can always squeeze some.

    --Lu Xun, Father of Modern Chinese Literature

  • Previous
    Next
    Reply
    Map
    View

    Click here to load this message in the networking platform