FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Problem with aGetFiles()
Posts: 97
Joined: Mon Nov 21, 2005 10:29 AM
Problem with aGetFiles()
Posted: Wed Oct 06, 2010 11:35 AM

Hello,
there seems to be a problem with new function aGetFiles() introduced in FWH 10.9.
At some file count (or maybe return string length) function cgetfile() call used in this function returns just emtpy string. User reported problem on XP, tested and problem exists also on Windows 7/64.

Taavi.

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Problem with aGetFiles()
Posted: Mon Oct 11, 2010 11:02 AM

Taavi,

What parameters are you supplying to the function ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 97
Joined: Mon Nov 21, 2005 10:29 AM
Re: Problem with aGetFiles()
Posted: Mon Oct 11, 2010 11:29 AM

Hi,
I tested with code:

if len(afailid:=agetfiles('Testfiles | *.dbf' ,'Please select files.'))==0
teade('Import katkestatud.')
return
endif

aeval(afailid,{|x| alert(x) })

Works when selecting 10 ..15 files, with 20 files selected returns empty array. Filenames with path are approx. 50 characters each.

Taavi.

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Problem with aGetFiles()
Posted: Mon Oct 11, 2010 11:47 AM

Taavi,

In function cGetFile() we use this amount of memory to be allocated: (5128)

pFile = ( LPSTR ) _xgrab( ( dwFlags & OFN_ALLOWMULTISELECT ) ? 5128 : 256 );

Please increase it (double or triple) and try it again, thanks :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 97
Joined: Mon Nov 21, 2005 10:29 AM
Re: Problem with aGetFiles()
Posted: Tue Oct 12, 2010 01:19 PM
Hi, tryed with

pFile = ( LPSTR ) hb_xgrab( ( dwFlags & OFN_ALLOWMULTISELECT ) ? 15384 : 256 );

No changes.
Taavi


Antonio Linares wrote:Taavi,

In function cGetFile() we use this amount of memory to be allocated: (5128)

pFile = ( LPSTR ) _xgrab( ( dwFlags & OFN_ALLOWMULTISELECT ) ? 5128 : 256 );

Please increase it (double or triple) and try it again, thanks :-)
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Problem with aGetFiles()
Posted: Wed Oct 13, 2010 12:27 AM
Taavi

please change this value too


Code (fw): Select all Collapse
ofn.nMaxFile        = ( dwFlags & OFN_ALLOWMULTISELECT ) ? 15384 : 256;
Posts: 97
Joined: Mon Nov 21, 2005 10:29 AM
Re: Problem with aGetFiles()
Posted: Wed Oct 13, 2010 09:34 AM
Thanks, it worked now.

shouldnt't we also change number here?

if ( dwFlags & OFN_ALLOWMULTISELECT ) hb_retclen( pFile, 5128 );


Daniel Garcia-Gil wrote:Taavi

please change this value too


Code (fw): Select all Collapse
ofn.nMaxFile        = ( dwFlags & OFN_ALLOWMULTISELECT ) ? 15384 : 256;
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Problem with aGetFiles()
Posted: Wed Oct 13, 2010 02:58 PM

I suggest that the value 5128 could be made into a manifest constant so it only has to be changed in one place in the future.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Problem with aGetFiles()
Posted: Wed Oct 13, 2010 04:31 PM

James,

Fixed for next build using a define constant :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion