Page 1 of 1

How to change LongName path to shortName path?

Posted: Fri Nov 06, 2009 8:12 am
by richard-service
Hi All,

Ex. c:\progam files\aaa" --> c:\program~1\aaa

Re: How to change LongName path to shortName path?

Posted: Fri Nov 06, 2009 10:40 am
by Enrico Maria Giordano
Try:

Code: Select all | Expand

Lfn2Sfn()


EMG

Re: How to change LongName path to shortName path?

Posted: Sat Nov 07, 2009 1:09 am
by richard-service
Enrico Maria Giordano wrote:Try:

Code: Select all | Expand

Lfn2Sfn()


EMG

Hi EMG,

Thanks. I will try it.
But I got Empty.

Ex.
Lfn2Sfn( curdir() )

OS: XP

Re: How to change LongName path to shortName path?

Posted: Sat Nov 07, 2009 9:28 am
by Antonio Linares
Richard,

Is CurDir() returning a long filename ?

Re: How to change LongName path to shortName path?

Posted: Sat Nov 07, 2009 10:29 am
by Enrico Maria Giordano
The following sample works fine here:

Code: Select all | Expand

#include "Fivewin.ch"


FUNCTION MAIN()

    MEMOWRIT( "This is a long name", "Test" )

    ? LFN2SFN( "This is a long name" )

    RETURN NIL


EMG

Re: How to change LongName path to shortName path?

Posted: Mon Nov 09, 2009 2:28 am
by richard-service
Antonio Linares wrote:Richard,

Is CurDir() returning a long filename ?

Yes, c:\program files

Re: How to change LongName path to shortName path?

Posted: Mon Nov 09, 2009 3:15 am
by richard-service
Enrico Maria Giordano wrote:The following sample works fine here:

Code: Select all | Expand

#include "Fivewin.ch"


FUNCTION MAIN()

    MEMOWRIT( "This is a long name", "Test" )

    ? LFN2SFN( "This is a long name" )

    RETURN NIL


EMG

? LFN2SFN( "This is a long name" ) --> Empty

Test FWH801

Re: How to change LongName path to shortName path?

Posted: Mon Nov 09, 2009 7:47 am
by Antonio Linares
Richard,

You need to have a file or a folder with that name in order to get LFN2SFN() working.

It is a Windows API requirement.

Re: How to change LongName path to shortName path?

Posted: Mon Nov 09, 2009 10:22 am
by Enrico Maria Giordano
richard-service wrote:? LFN2SFN( "This is a long name" ) --> Empty

Test FWH801


Are you using my sample without changes? If yes, do you want my EXE to test there? I'm using latest FWH.

EMG

Re: How to change LongName path to shortName path?

Posted: Mon Nov 09, 2009 12:13 pm
by Antonio Linares
Enrico,

You example works fine because you are previously creating a longname file.

If Silvio does not create it, as he should do, then the Windows API will not work :-)