From: "Dicky Low" <dicky@hartalega-bb.com.my>
Subject: Re: cGetFile()
Date: Wednesday, April 09, 2003 8:34 PM
Hi,
Found a solution. The 7th parameter of cGetFile() is the flags to control
the multiple files selection. But the cGetFile have a little bug which
ignore your previous flag if you pass in the 7th parameter.
To correct the cGetFile(), refer to line 164
if( dwFlags )
ofn.Flags = dwFlags;
Just change it to
if( dwFlags )
ofn.Flags |= dwFlags;
And everything will work perfectly well.
Lastly, the 7th parameter to pass in is hex 200 which is decimal 512
Regards
Dicky
"Marcelo Via Giglio" <via@dicyt.umss.edu.bo> wrote in message
news:3E93E70B.61D25D91@dicyt.umss.edu.bo...
> Hello,
>
> you can put the result of directory into Multisel Browse
> (Hernan's Browse)
>
> Regards
>
> Marcelo
>
> Dicky Low wrote:
>
> > Steve,
> >
> > I mean getting multiple files in the return. Your example below show
cPath,
> > and I assume it is single file selected and not multiple files like what
we
> > can do with windows explorer when you can select multiple files to
delete,
> > etc, etc...
> >
> > Regards
> > Dicky
> >
> > "Aberdeen IT" <operations@aberdeenit.com> wrote in message
> > news:3e93ddf8$1@oznt1.ozlan.local...
> > > Dicky
> > >
> > > This code works with FW2.1 ...
> > >
> > > cPath := cGetFile32("MS Word (*.doc) | *.doc |" + ;
> > > "MS Excel (*.xls) | *.xls |" + ;
> > > "Acrobat Reader (*.pdf) | *.pdf",
"Select
> > a
> > > file", 1)
> > >
> > > I cannot remember exactly what the last parameter does, but I think
it's
> > to
> > > highlight the starting element, i.e. the first element in the above
> > example.
> > >
> > > Regards
> > > Steve Lai
> > >
> > >
> > > "Dicky Low" <dicky@hartalega-bb.com.my> wrote in message
> > > news:3e93c98f@oznt1.ozlan.local...
> > > > Hi,
> > > >
> > > > Anyone has any ideas how can we select multiple files in cGetFile()
or
> > is
> > > > there any alternative function?
> > > >
> > > > Regards
> > > > Dicky Low
> > > >
> > > >
> > >
> > >
>
From: "Enrico Maria Giordano" <e.m.giordano@emagsoftware.it>
Subject: Re: Long file names
Date: Friday, November 29, 2002 3:52 AM
Randal Ferguson wrote:
>
> All,
>
> I'm using cGetFile32 but the file name returned is the short file name. How
> do I get the long file name?
A working sample follows:
#include "Fivewin.ch"
FUNCTION MAIN()
? CGETFILE32( "*.*", "Test", , , , 2060 )
RETURN NIL
EMG
#include "Fivewin.ch"
#define OFN_ALLOWMULTISELECT 0x200
#define OFN_EXPLORER 0x80000
FUNCTION MAIN()
? CGETFILE( "*.*", "Test", , , , , NOR( OFN_ALLOWMULTISELECT, OFN_EXPLORER ) )
RETURN NIL
Vytas wrote:I get the same results as you. Is this a bug in FiveWin?
#include "Fivewin.ch"
#define OFN_HIDEREADONLY 0x4
#define OFN_ALLOWMULTISELECT 0x200
#define OFN_EXPLORER 0x80000
FUNCTION MAIN()
LOCAL cFile := CGETFILE( "*.*", "Test", , , , , NOR( OFN_ALLOWMULTISELECT, OFN_EXPLORER, OFN_HIDEREADONLY ) )
LOCAL aFile := {}
LOCAL cPath
IF !EMPTY( cFile )
cPath = LEFT( cFile, AT( CHR( 0 ), cFile ) - 1 )
IF RIGHT( cPath, 1 ) != "\"; cPath += "\"; ENDIF
WHILE .T.
cFile = SUBSTR( cFile, AT( CHR( 0 ), cFile ) + 1 )
IF LEFT( cFile, 1 ) = CHR( 0 ); EXIT; ENDIF
AADD( aFile, cPath + LEFT( cFile, AT( CHR( 0 ), cFile ) - 1 ) )
ENDDO
IF LEN( aFile ) = 1
aFile[ 1 ] = LEFT( aFile[ 1 ], LEN( aFile[ 1 ] ) - 1 )
ENDIF
ENDIF
WQOUT( aFile )
RETURN NIL
#pragma BEGINDUMP
#include <Windows.h>
#include <CommDlg.h>
#include <ClipApi.h>
#include <HbApi.h>
static far WORD wIndex;
static far char Title[] = "Select the file";
HB_FUNC( CGETFILE ) // ( cFileMask, cTitle, nDefaultMask, ;
// cInitDir, lSave, lLongNames, nFlags, ;
// cIniFile ) --> cFileName
{
OPENFILENAME ofn;
LPSTR pFile, pFilter, pDir, pTitle;
WORD w = 0, wLen;
BYTE bIndex = ( BYTE ) hb_parni( 3 );
BOOL bSave = IF( PCOUNT() > 4 && ISLOGICAL( 5 ), hb_parl( 5 ), FALSE );
BOOL bLongNames = hb_parl( 6 );
DWORD dwFlags = IF( PCOUNT() > 6 && ISNUM( 7 ), hb_parnl( 7 ), 2060 );
if( PCOUNT() < 1 )
{
hb_retc( "" );
return;
}
// alloc for title
pTitle = ( LPSTR ) hb_xgrab( 128 );
if ( PCOUNT() > 1 && ISCHAR( 2 ) )
{
wLen = ( WORD ) min( ( unsigned long ) 127, hb_parclen( 2 ) );
_bcopy( pTitle, hb_parc( 2 ), wLen );
* ( pTitle + wLen ) = 0;
}
else
{
pTitle = Title;
}
// alloc for initial dir
pDir = ( LPSTR ) hb_xgrab( 128 );
if ( PCOUNT() > 3 && ISCHAR( 4 ) )
{
wLen = ( WORD ) min( ( unsigned long ) 127, hb_parclen( 4 ) );
_bcopy( pDir, hb_parc( 4 ), wLen );
* ( pDir + wLen ) = 0;
}
else
{
* ( pDir ) = 0;
}
// alloc for file
if ( dwFlags & OFN_ALLOWMULTISELECT )
pFile = ( LPSTR ) hb_xgrab( 32768 );
else
pFile = ( LPSTR ) hb_xgrab( 128 );
if ( PCOUNT() > 7 && ISCHAR( 8 ) )
{
wLen = ( WORD ) min( ( unsigned long ) 127, hb_parclen( 8 ) );
_bcopy( pFile, hb_parc( 8 ), wLen );
}
else
{
wLen = ( WORD ) min( ( unsigned long ) 127, hb_parclen( 1 ) );
_bcopy( pFile, hb_parc( 1 ), wLen );
}
* ( pFile + wLen ) = 0;
// alloc for mask
pFilter = ( LPSTR ) hb_xgrab( 400 );
wLen = ( WORD ) min( ( unsigned long ) 398, hb_parclen( 1 ) );
_bcopy( pFilter, hb_parc( 1 ), wLen );
* ( pFilter + wLen ) = 0;
while( * ( pFilter + w ) )
{
if( * ( pFilter + w ) == '|' )
{
* ( pFilter + w ) = 0;
if ( PCOUNT() < 8 )
* (pFile) = 0;
}
w++;
}
* ( pFilter + wLen ) = 0;
* ( pFilter + wLen + 1 ) = 0;
_bset( ( char * ) &ofn, 0, sizeof( OPENFILENAME ) );
ofn.lStructSize = sizeof( OPENFILENAME );
ofn.hwndOwner = GetActiveWindow();
ofn.lpstrFilter = pFilter;
ofn.lpstrFile = pFile;
ofn.lpstrInitialDir = pDir;
ofn.lpstrTitle = pTitle;
ofn.lpstrCustomFilter = 0; // NIL;
ofn.nFilterIndex = bIndex ? bIndex: 1;
ofn.nMaxFile = dwFlags & OFN_ALLOWMULTISELECT ? 32768 : 128;
ofn.lpstrFileTitle = 0; // NIL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR |
IF( bSave, OFN_HIDEREADONLY, 0 ) |
IF( bLongNames, OFN_LONGNAMES, 0 );
if( dwFlags )
ofn.Flags = dwFlags;
wIndex = 0;
if( bSave )
{
if( GetSaveFileName( &ofn ) )
hb_retc( pFile );
else
hb_retc( "" );
}
else
{
if( GetOpenFileName( &ofn ) )
if ( dwFlags & OFN_ALLOWMULTISELECT )
hb_retclen( pFile, 32768 );
else
hb_retc( pFile );
else
hb_retc( "" );
}
wIndex = ( WORD ) ofn.nFilterIndex;
hb_xfree( pFilter );
hb_xfree( pFile );
hb_xfree( pDir );
hb_xfree( pTitle );
}
#pragma ENDDUMP
Vytas wrote:Error E2209 .\VYTAS01.PRG 41: Unable to open include file 'ClipApi.h'
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 63 guests