How to change LongName path to shortName path?

How to change LongName path to shortName path?

Postby richard-service » Fri Nov 06, 2009 8:12 am

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: 804
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan


Re: How to change LongName path to shortName path?

Postby richard-service » Sat Nov 07, 2009 1:09 am

Enrico Maria Giordano wrote:Try:

Code: Select all  Expand view  RUN
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
richard-service
 
Posts: 804
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: How to change LongName path to shortName path?

Postby Antonio Linares » Sat Nov 07, 2009 9:28 am

Richard,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: How to change LongName path to shortName path?

Postby Enrico Maria Giordano » Sat Nov 07, 2009 10:29 am

The following sample works fine here:

Code: Select all  Expand view  RUN
#include "Fivewin.ch"


FUNCTION MAIN()

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

    ? LFN2SFN( "This is a long name" )

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: How to change LongName path to shortName path?

Postby richard-service » Mon Nov 09, 2009 2:28 am

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: 804
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: How to change LongName path to shortName path?

Postby richard-service » Mon Nov 09, 2009 3:15 am

Enrico Maria Giordano wrote:The following sample works fine here:

Code: Select all  Expand view  RUN
#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
richard-service
 
Posts: 804
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: How to change LongName path to shortName path?

Postby Antonio Linares » Mon Nov 09, 2009 7: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: How to change LongName path to shortName path?

Postby Enrico Maria Giordano » 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
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: How to change LongName path to shortName path?

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 38 guests