Jump to content
Fivewin Brasil

cGetFile 16bits FW 2.0 b


EduViggiano

Recommended Posts

MsgStop( cGetFile( "*.doc", "Escolha",,,,.T. ) )

MsgStop( cGetFile32( "*.doc", "Escolha",,,,.T. ) )

Olá Fw´s, essa chamada acima não traz nomes longos mesmo lascando o .T. confme instrução do Help.

em www.dbwide.com.ar vi que tem um cGetFile2, porem não consigo fazer download, está quebrado o link...

Alguem tem uma luz ai por favor..

Abraços,

Edu-DESIS

SP-Z/S

Link to comment
Share on other sites

Ola voce pode utilizar o proprio fivewin para faze isto para voce

SFN2LFN( seu texto )

Onde você vê um obstáculo alguém vê o término da viagem e o outro vê uma chance de crescer.

Elias Abrão Júnior

Fone : (0**11) 5181-6909 São Paulo - SP

eajunior.fw@terra.com.br

xHarbour 0.99.0 - Fivewin 2.5 e xMate

Link to comment
Share on other sites

Olá Elias, boa tarde, eu sei que essa função Sfl2Lfn faz isso, é que eu preciso dessa telinha de interface pro usuário poder ir clicando e buscar um arquivo Doc que ele deseja...

Eles tem trocentos .DOC espalhado por váaaaaaaarios diretórios, ai ele só sabe que está dentro da pasta tal...

então com essa interface do cGetFile, ele vai clicando, clicando e acha, ao achar dá um enter e me retorna qual doc escolheu, ai eu tomo uma ação entendeu a redação acima? icon_smile_blush.gif

eu preciso uma interface dessa.. inclusive estava pensando, se o nome for CONTRATO_DE_MANUTENCAO_DO_JOSE.DOC, nem vai caber na janela esquerda...icon_smile_blackeye.gif

Abraços,

Edu-DESIS

SP-Z/S

Link to comment
Share on other sites

#Include "FiveWin.Ch"

#Include "Struct.Ch"

/*

Managing Longfile Name :

*/

FUNCTION cGetFile( cMask, cTitle, Z, cDefDir, cFile, nGetSave, cExt )

LOCAL hDll := LoadLib32( "LFN.DLL" )

LOCAL cFileName := NIL

DEFAULT nGetSave := 0

DEFAULT cExt := ""

IF Abs( hDll ) >= 32

cFileName := cLFNGet2( hDll, cTitle, cMask, cDefDir, ;

cFile, nGetSave, cExt )

IF ValType( cFileName ) = "C"

cFileName := AllTrim( cFileName )

IF Empty(cFileName )

cFileName := NIL

ENDIF

ELSE

cFileName := NIL

ENDIF

ENDIF

IF Empty( cFileName )

RETURN "" ///

ENDIF

FreeLib32( hDll )

SysRefresh()

cFileName := StrTran( cFileName, Chr( 0 ) ) //elimina los Chr( 0 )

RETURN AllTrim( cFileName )

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

STATIC FUNCTION cLFNGet2( hDll, cTitle, cMask, cDefDir, ;

cFile, nGetSave, cExt )

LOCAL xReto, xRetVal

LOCAL nAt, nLen, ;

hWnd := GetHWnd32( GetActiveWindow() )

LOCAL cFarProc, ;

cNewMask := "", ;

c300 := Space( 300 ) + Chr( 0 )

DEFAULT nGetSave := 0

DEFAULT cTitle := "Informe/Troque o Arquivo", ;

cExt := ""

cExt := AllTrim( cExt ) + Chr( 0 )

IF Empty( cFile )

cFile := " " + Chr( 0 )

ELSE

cFile := AllTrim( cFile ) + Chr( 0 )

END

IF cMask = nil

DEFAULT cMask := "Todos os Arquivos" + Chr( 0 ) + "*.*" + CHR( 0 ) + CHR( 0 )

cNewMask := cMask

ELSE

nLen := Len( cMask )

Do While .T.

nAt := At( "|", cMask )

If nAt > 0

cNewMask += Left( cMask, nAt - 1 ) + Chr( 0 )

cMask := SubStr( cMask, nAt + 1 )

Else

cNewMask += cMask + Chr( 0 ) + Chr( 0 )

Exit ///

Endif

EndDo

ENDIF

cFarProc := GetProc32( hDll, ;

"LFNGet", ;

.T., ;

LONG, ;

LONG, ; // handle

LPSTR, ; // returned file name

LPSTR, ; // titolo

LPSTR, ; // mask

LPSTR, ; // dir

LPSTR, ; // initial file name

LONG, ; // nGetSave = 1 ( if 1 want to save a file ) else = 0

LPSTR ) // cExt if u want a fixed exension when saving: tree chars only e.g. "TXT"

xReto := CallDll32( cFarProc, hWnd, ;

@c300, @cTitle, @cNewMask, @cDefDir, @cFile, nGetSave, @cExt )

RETURN c300

// FIM DO PROGRAMA

Completo nas DICAS. Abraços.

Bad Boy - The HuntsMan Of E.A.J. Automação Comercial.

kapiaba@brfree.com.br

FW 2.3C CLIPPER 5.3B BLINKER 7.0 WORKSHOP.EXE

Editado por - kapiaba on 11/05/2005 17:57:05

Link to comment
Share on other sites

FUNCTION LFNDirectory( cDir, cAttr )

Local aDir := {}, cPath := "", nSlash

If ( nSlash := RAt( "\", cDir ) ) > 0 .or. ( nSlash := RAt( "/", cDir ) ) > 0

cPath := AnsiToOem( LFN2SFN( OemToAnsi( SubStr( cDir, 1, nSlash ) ) ) )

cDir := SubStr( cDir, nSlash + 1 )

If Empty( cPath ) // invalid short dir from long path name

Return aDir // return empty array, just like Directory()

Endif

Endif

aDir := Directory( cPath + cDir, cAttr ) // strings MUST be in OEM format

AEval( aDir, {|aFile| aFile[1] := SFN2LFN( OemToAnsi( cPath + aFile[1] ) ) } )

RETURN aDir

Bad Boy - The HuntsMan Of E.A.J. Automação Comercial.

kapiaba@brfree.com.br

FW 2.3C CLIPPER 5.3B BLINKER 7.0 WORKSHOP.EXE

Link to comment
Share on other sites

// Tente Agora...

#Include "FiveWin.Ch"

#Include "Struct.Ch"

/*

Managing Longfile Name :

*/

FUNCTION cGetFile2( cMask, cTitle, Z, cDefDir, cFile, nGetSave, cExt )

LOCAL hDll := LoadLib32( "LFN.DLL" )

LOCAL cFileName := NIL

DEFAULT nGetSave := 0

DEFAULT cExt := ""

IF Abs( hDll ) >= 32

cFileName := cLFNGet2( hDll, cTitle, cMask, cDefDir, ;

cFile, nGetSave, cExt )

IF ValType( cFileName ) = "C"

cFileName := AllTrim( cFileName )

IF Empty(cFileName )

cFileName := NIL

ENDIF

ELSE

cFileName := NIL

ENDIF

ENDIF

IF Empty( cFileName )

RETURN "" ///

ENDIF

// FreeLib32( hDll )

// Mude Isso

FreeResources() // Set Resources To

SysRefresh()

cFileName := StrTran( cFileName, Chr( 0 ) ) //elimina los Chr( 0 )

RETURN AllTrim( cFileName )

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

STATIC FUNCTION cLFNGet2( hDll, cTitle, cMask, cDefDir, ;

cFile, nGetSave, cExt )

LOCAL xReto, xRetVal

LOCAL nAt, nLen, ;

hWnd := GetHWnd32( GetActiveWindow() )

LOCAL cFarProc, ;

cNewMask := "", ;

c300 := Space( 300 ) + Chr( 0 )

DEFAULT nGetSave := 0

DEFAULT cTitle := "Informe/Troque o Arquivo", ;

cExt := ""

cExt := AllTrim( cExt ) + Chr( 0 )

IF Empty( cFile )

cFile := " " + Chr( 0 )

ELSE

cFile := AllTrim( cFile ) + Chr( 0 )

END

IF cMask = nil

DEFAULT cMask := "Todos os Arquivos" + Chr( 0 ) + "*.*" + CHR( 0 ) + CHR( 0 )

cNewMask := cMask

ELSE

nLen := Len( cMask )

Do While .T.

nAt := At( "|", cMask )

If nAt > 0

cNewMask += Left( cMask, nAt - 1 ) + Chr( 0 )

cMask := SubStr( cMask, nAt + 1 )

Else

cNewMask += cMask + Chr( 0 ) + Chr( 0 )

Exit ///

Endif

EndDo

ENDIF

cFarProc := GetProc32( hDll, ;

"LFNGet", ;

.T., ;

LONG, ;

LONG, ; // handle

LPSTR, ; // returned file name

LPSTR, ; // titolo

LPSTR, ; // mask

LPSTR, ; // dir

LPSTR, ; // initial file name

LONG, ; // nGetSave = 1 ( if 1 want to save a file ) else = 0

LPSTR ) // cExt if u want a fixed exension when saving: tree chars only e.g. "TXT"

xReto := CallDll32( cFarProc, hWnd, ;

@c300, @cTitle, @cNewMask, @cDefDir, @cFile, nGetSave, @cExt )

RETURN c300

// FIM DO PROGRAMA

Bad Boy - The HuntsMan Of E.A.J. Automação Comercial.

kapiaba@brfree.com.br

FW 2.3C CLIPPER 5.3B BLINKER 7.0 WORKSHOP.EXE

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...