Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GETFILE equivalent supporting multiple file selection
Message
From
01/02/2005 17:17:05
 
 
To
01/02/2005 16:43:26
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
00982882
Message ID:
00982901
Views:
15
>Is there a way of displaying a dialog that allows multiple files to be selected and returned?
>
>It looks like the Windows function GetOpenFileName might be the answer, but I cannot find any workable sample.


I use the CommonDialog Control for that.

Something like:
* setup Common Dialog Control
#define COMMDLOG_DEFAULT_FLAG 0x00080000
#define COMMDLOG_RO 4
#define COMMDLOG_MULTFILES 512
ThisForm.oleCommDlog.Flags = COMMDLOG_DEFAULT_FLAG + COMMDLOG_RO + COMMDLOG_MULTFILES
ThisForm.oleCommDlog.Flags = COMMDLOG_MULTFILES
ThisForm.oleCommDlog.FileName = "*.txt"
ThisForm.oleCommDlog.Filter = "Text files|*.txt"
ThisForm.oleCommDlog.MaxFileSize=3500

* Display file dialog
ThisForm.oleCommDlog.ShowOpen()

* value(s) are returned in: thisform.oleCommDlog.FileName
If Empty(ThisForm.oleCommDlog.FileName) or (ThisForm.oleCommDlog.FileName == "*.txt")
  * user pressed Cancel,or else didn't select any file
  ThisForm.aFiles[1]=.F.
Else
  * parse file(s) selected (separated by spaces)
  ALines(ThisForm.aFiles,ThisForm.oleCommDlog.FileName,.T.," ")
EndIf
HTH


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform