Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discussions

Multiple Selection of Files in GetOpenFileName

Intel_C_Intel
Employee
547 Views
Hi,

when I try to make multiple selection of files in GetOpenFileName setting the OFN_ALLOWMULTISELECT flag I can select more than one file but the returned value of the buffer is the directory name only. I read the documentation of this function but I can not understand how can I get the name of EACH of the selected files.
Can somebody help me?
Thanks in advance!
Stan
0 Kudos
1 Reply
james1
Beginner
547 Views
It depends on whether you are using old interface or explorer interface, but your return value has the directory followed by all the files selected, delimited by spaces (old) or nulls (new). Simple example:
 
program test
use comdlg32
implicit none
character*1024 files
type (T_OPENFILENAME) fn
integer base /1/, length
files = "*.*"c
fn%lStructSize = SIZEOF (fn)
fn%lpstrFile = LOC (files)
fn%nMaxFile = SIZEOF (files)
fn%Flags = OFN_ALLOWMULTISELECT .or. OFN_EXPLORER
if (GetOpenFileName(fn) .ne. 0) then
length = INDEX (files, char(0))
do while (length .gt. 1)
type *, 'Filename is ', files(base:base+length-1)
base = base + length
length = INDEX (files(base:), char(0))
end do
end if
end

James
0 Kudos
Reply