- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I have one question.
Namely, I write application which uses function/procedure GETOPENFILENAME. Under structure type Flags I put"ofn_explorer .or. ofn_allowmultiselect" which means that I want Explorer-style dialog box and multiple selections of files.
But when I want to read or get information about selected files and directory in string structure type lpstrFile, I get only directory without files. How can I get full path and all files which I selected? When I exclude ofn_explorer flag (old style dialog box) everything is OK, but I want new style dialog box.
Thank You.
Kreso.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Rehi Kreso,
The information is (supposed to be) there, but it's a bit hidden. In case of multi-select dialog box, the directory name is followed by char(0), followed by char(0)-separated list of file names, terminated by double char(0). Thus, you have to parse the string to retrieve the list of file names:
Code:
!Assuming "szFiles" is the string to parse (OFN%lpstrFile) nBegin=1 !Index of 1st character in next filename nFiles=0 !Number of files retrieved DO nNextZero = nBegin + INDEX(szFiles(nBegin:), CHAR(0))-1 IF (nNextZero-nBegin .LE. 1) EXIT !Terminal double zero IF (nBegin.EQ.1) THEN !Directory name sDir = szFiles(nBegin:nNextZero-1) ELSE !File names nFiles = nFiles+1 sFile = szFiles(nBegin:nNextZero-1) !Do something with sFile (or, better, TRIM(sDir)//""//sFile) END IF nBegin = nNextZero + 1 END DO
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Jugoslav! That is solution for my problem.
Best regards.
Kreso.

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