FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to change LongName path to shortName path?
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
How to change LongName path to shortName path?
Posted: Fri Nov 06, 2009 08:12 AM

Hi All,

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

Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: How to change LongName path to shortName path?
Posted: Fri Nov 06, 2009 10:40 AM
Try:

Code (fw): Select all Collapse
Lfn2Sfn()


EMG
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
Re: How to change LongName path to shortName path?
Posted: Sat Nov 07, 2009 01:09 AM
Enrico Maria Giordano wrote:Try:

Code (fw): Select all Collapse
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 (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: How to change LongName path to shortName path?
Posted: Sat Nov 07, 2009 09:28 AM

Richard,

Is CurDir() returning a long filename ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: How to change LongName path to shortName path?
Posted: Sat Nov 07, 2009 10:29 AM
The following sample works fine here:

Code (fw): Select all Collapse
#include "Fivewin.ch"


FUNCTION MAIN()

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

    ? LFN2SFN( "This is a long name" )

    RETURN NIL


EMG
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
Re: How to change LongName path to shortName path?
Posted: Mon Nov 09, 2009 02:28 AM
Antonio Linares wrote:Richard,

Is CurDir() returning a long filename ?

Yes, c:\program files
Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
Re: How to change LongName path to shortName path?
Posted: Mon Nov 09, 2009 03:15 AM
Enrico Maria Giordano wrote:The following sample works fine here:

Code (fw): Select all Collapse
#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 (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: How to change LongName path to shortName path?
Posted: Mon Nov 09, 2009 07:47 AM

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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: How to change LongName path to shortName path?
Posted: Mon Nov 09, 2009 10:22 AM
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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: How to change LongName path to shortName path?
Posted: Mon Nov 09, 2009 12:13 PM

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

Continue the discussion