How to change LongName path to shortName path?

Post Reply
User avatar
richard-service
Posts: 808
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Has thanked: 2 times
Contact:

How to change LongName path to shortName path?

Post by richard-service »

Hi All,

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

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
Posts: 808
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Has thanked: 2 times
Contact:

Re: How to change LongName path to shortName path?

Post 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
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
Antonio Linares
Site Admin
Posts: 42595
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 38 times
Been thanked: 86 times
Contact:

Re: How to change LongName path to shortName path?

Post by Antonio Linares »

Richard,

Is CurDir() returning a long filename ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 8761
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 5 times
Contact:

Re: How to change LongName path to shortName path?

Post 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
User avatar
richard-service
Posts: 808
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Has thanked: 2 times
Contact:

Re: How to change LongName path to shortName path?

Post by richard-service »

Antonio Linares wrote:Richard,

Is CurDir() returning a long filename ?

Yes, c:\program files
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
Posts: 808
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Has thanked: 2 times
Contact:

Re: How to change LongName path to shortName path?

Post 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
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
Antonio Linares
Site Admin
Posts: 42595
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 38 times
Been thanked: 86 times
Contact:

Re: How to change LongName path to shortName path?

Post 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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 8761
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 5 times
Contact:

Re: How to change LongName path to shortName path?

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 42595
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 38 times
Been thanked: 86 times
Contact:

Re: How to change LongName path to shortName path?

Post 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 :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply