- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
James
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

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page