QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: euklides on May 02, 2021, 10:39:14 am

Title: About "Opening files"
Post by: euklides on May 02, 2021, 10:39:14 am

Please see:
https://www.qb64.org/forum/index.php?topic=2689.msg119268#top  (locked)

Well, the program given by bplus works fine, but you can select only ONE file.

Is there a way to select directly multiple files (located  in a directory, of course) ?

Title: Re: About "Opening files"
Post by: bplus on May 02, 2021, 04:18:59 pm
There is a way to select multiple files but not directly, something you would have to code unless the API guy has something through Windows?

I am thinking of a UDT array with file names and some little symbol place next to each to indicate if user selected it or not, or you might try shading the items that are selected with each redraw in loop.
Title: Re: About "Opening files"
Post by: euklides on May 03, 2021, 02:48:02 am
For output the selection of multiple files:
Using _CLIPBOARD$, you put all the file name selected.
_CLIPBOARD$ = <file name 1> + chr$(0) + <file name 2> + chr$(0)  ... aso
then splitting...
------------------------------
But how select multiple files ?

in the program you have:
CONST OFN_ALLOWMULTISELECT = &H200& '  Allows the user to select more than one file, not recommended! 

But impossible to select more than on file...
Title: Re: About "Opening files"
Post by: bplus on May 03, 2021, 10:50:06 am
Quote
in the program you have:
CONST OFN_ALLOWMULTISELECT = &H200& '  Allows the user to select more than one file, not recommended!

OK that's not my program, but it would be good exercise to have multi-file selection and cross platform and select paths too!
Title: Re: About "Opening files"
Post by: NOVARSEG on May 03, 2021, 10:49:28 pm
Quote
Is there a way to select directly multiple files (located  in a directory, of course) ?

Yep sure why not.  You can select multiple files that can also be opened at the same time.

Title: Re: About "Opening files"
Post by: euklides on May 04, 2021, 03:37:14 am
Of course, if you change
  Flags& = OFN_FILEMUSTEXIST + OFN_NOCHANGEDIR + OFN_READONLY
with
  Flags& = OFN_ALLOWMULTISELECT + OFN_FILEMUSTEXIST + OFN_NOCHANGEDIR + OFN_READONLY
before using  GetOpenFileName$(...) command, you can select multiple files and see them in the OFile$ variable. (file names separated with space)

BUT... sometime you can get only the short name of the files (ex: demontration number 1.jpg--> demontr~1.jgp)