long file names

long file names

Postby Peterg » Wed Mar 29, 2006 5:34 pm

Hello
I am trying to use lcreat to create long file names but each time i try i get a truncated name 8 characters long.

I can use the clfn.dll and this seems to work but occassionally it writes truncated file names aswell

Anybody any ideas

Peter
Peterg
 
Posts: 62
Joined: Mon Nov 28, 2005 5:36 pm
Location: Oxford UK

Postby Antonio Linares » Wed Mar 29, 2006 5:36 pm

Peter,

Please review samples\LongName.prg
regards, saludos

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

Postby Peterg » Thu Mar 30, 2006 8:06 am

I have used this but I just get truncated file names

Peter
Peterg
 
Posts: 62
Joined: Mon Nov 28, 2005 5:36 pm
Location: Oxford UK

Postby Antonio Linares » Thu Mar 30, 2006 9:48 am

Peter,

It looks as a 16 bits limitation. With Harbour and FWH it works ok.
regards, saludos

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

Postby Peterg » Thu Mar 30, 2006 9:59 am

Yes it does work with fwh and gradually moving over to this

thanks
Peter
Peterg
 
Posts: 62
Joined: Mon Nov 28, 2005 5:36 pm
Location: Oxford UK

Postby dbSoft » Fri Mar 31, 2006 8:50 am

REDEFINE GET oGetXls VAR cGetXls ID 102 OF oDlg ;
FONT oFont
REDEFINE BTNBMP ID 106 FILENAME lCUR + "\openXls.bmp" OF oDlg ;
ACTION ( cGetXls := cGetDir32("Select folder") , oGetXls:Refresh() )

Code: Select all  Expand view  RUN
//-------------------------------------------
//  DLGS32.PRG
//-------------------------------------------
// 32 bits common dialogs from 16 bits apps

#include "FiveWin.ch"

#define INIFILE GetWinDir()+"\rundlg32.ini"

static nFilterIndex := 0

//----------------------------------------------------------------------------//

Function cGetFile32(cFileMask, cTitle, nDefaultMask, cInitDir, lSave, nFlags)

   local cSection, cFile
   local nRet

   DEFAULT lSave := .f.

   // On cGetFile() that parameter is a boolean for long filenames

   if nFlags != Nil .and. Valtype(nFlags) != "N"
      nFlags := Nil
   endif

   if !lSave
      cSection := "GetOpenFileName"
   else
      cSection := "GetSaveFileName"
   endif

   if File(INIFILE)
      Ferase(INIFILE)
   endif

   if cFileMask != Nil
      if "|"$cFileMask
         cFileMask := StrTran(cFileMask, " |", "|")
         cFileMask := StrTran(cFileMask, "| ", "|")
         WritePProString( cSection, "lpstrFilter", cFileMask, INIFILE )
      else
         WritePProString( cSection, "lpstrFile", cFileMask, INIFILE )
      endif
   endif

   if cTitle != Nil
      WritePProString( cSection, "lpstrTitle", cTitle, INIFILE )
   endif

   if nDefaultMask != Nil
      WritePProString( cSection, "nFilterIndex", ltrim(Str(nDefaultMask)), INIFILE )
   endif

   if cInitDir != Nil
      WritePProString( cSection, "lpstrInitialDir", cInitDir, INIFILE )
   endif

   if nFlags != Nil
      WritePProString( cSection, "Flags", ltrim(Str(nFlags)), INIFILE )
   endif

   WritePProString( cSection, "hwndOwner", lTrim(Str( GetActiveWindow()) ),;
                    INIFILE )
   if IsWin2000()
     nRet := WinExec( "rundlg32 "+iif( lSave, "2", "1") )
   else
     nRet := 0
   endif
   if nRet > 21 .or. nRet < 0
      StopUntil( {|| GetPvProfString( cSection, "working", "0", INIFILE ) != "1"} )
      /*while GetPvProfString( cSection, "working", "0", INIFILE ) == "1"
         SysRefresh()
      end*/

      cFile        := GetPvProfString( cSection, "lpstrFile", "", INIFILE )
      nFilterIndex := Val(GetPvProfString( cSection, "nFilterIndex", "", INIFILE ))
   else
       cFile := cGetFile(cFileMask, cTitle, nDefaultMask, cInitDir, lSave,, nFlags)
   endif

   Ferase(INIFILE)

return cFile

//----------------------------------------------------------------------------//

Function nGetFilter32()

Return nFilterIndex

//----------------------------------------------------------------------------//

Function cGetDir32(cTitle)

   local cDir
   local nRet

   if File(INIFILE)
      Ferase(INIFILE)
   endif

   if cTitle != Nil
      WritePProString( "GetDirectory", "lpstrTitle", cTitle, INIFILE )
   endif

   WritePProString( "GetDirectory", "hwndOwner", lTrim(Str( GetActiveWindow()) ),;
                    INIFILE )

   nRet := WinExec( "rundlg32 3" )

   if nRet > 21 .or. nRet < 0
      StopUntil( {|| GetPvProfString( "GetDirectory", "working", "0", INIFILE ) != "1"} )
      /*while GetPvProfString( "GetDirectory", "working", "0", INIFILE ) == "1"
         SysRefresh()
      end*/
      cDir := GetPvProfString( "GetDirectory", "lpstrDirectory", "", INIFILE )
   else
      cDir := cGetDir(cTitle)
   endif

   Ferase(INIFILE)

return cDir

//----------------------------------------------------------------------------//

FUNCTION IsWin2000() ; RETURN IsWinNT() .and. GetWinVer()[2] == 95


[quote][/quote]
User avatar
dbSoft
 
Posts: 16
Joined: Thu Oct 13, 2005 8:31 pm
Location: Greece

Postby Mdandrea » Sat Apr 01, 2006 12:27 am

You could create it with a temp file name using 8.3 convention, and use the movefile api call to move it to a long file name.

Movefile ( "c:\temp\temp.fil" +chr(0) , "c:\folder\long file name.fil" +chr(0))
DLL32 FUNCTION MOVEFILE( cOldName AS LPSTR, cNewName AS LPSTR ) AS BOOL;
PASCAL FROM "MoveFileA" LIB "kernel32.dll"
Mdandrea
 
Posts: 21
Joined: Wed Nov 23, 2005 12:24 am

Postby Peterg » Mon Apr 03, 2006 7:51 am

I have found a tfln on Patrick Mast old pages which works very well. Only needs an extra obj linked in and very simple

Peter
Peterg
 
Posts: 62
Joined: Mon Nov 28, 2005 5:36 pm
Location: Oxford UK


Return to FiveWin for CA-Clipper

Who is online

Users browsing this forum: No registered users and 3 guests