Announcement

Collapse
No announcement yet.

long and short filenames...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • long and short filenames...

    hello,

    I downloaded a command line app that does conversion, and it will only accept short filenames on the command line. This isn't a problem because after I use a open file dialog to get the source file, I pass that filename to GetShortPathName, and voila - I have a short filename source to feed to the conversion app. However, my problem happens when I try to use the same process to build a short destination filename as follows:

    'create a long destination manually
    longDest=progPath+"parse.txt"

    'now make the call
    GetShortPathName(longDest, shortDest, SIZEOF(shortDest))

    Basically, the call tanks, and I don't get my short filename destination. What do you suppose was so right about the string passed from the open file dialog, and that which I created manually?

    -CMR

  • #2
    >Basically, the call tanks,

    You can query the return of GetShortPathName and use GetLastError() if it failed to get a reason for the failure.

    Insufficient code shown but I'll make some guesses

    You might be missing a "\" after ProgPath before '"+parse.text"'

    parse.txt might not exist. (GetShortPathName fails if file does not exist).

    If shortdest is a STRING you must initialize and pass its LEN and address of the data,
    not its SIZEOF (=4) and the address of its handle.

    MCM
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment

    Working...
    X