<< Click to Display Table of Contents >> Navigation: ThinBASIC Modules > UI (User Interface) > Common Dialogs > Dialog_OpenFile |
Description
Open common open file dialog.
Syntax
sFile = Dialog_OpenFile(hwnd, Caption, DefaultDirectory, FileFilter, DefaultExtension, Options)
Returns
String.
Parameters
Name |
Type |
Optional |
Meaning |
hwnd |
Number |
No |
Handle of the dialog containing the control |
Caption |
String |
No |
Dialog caption |
DefaultDirectory |
String |
No |
Default starting dialog directory (plus optional file name) If this parameter contains also a file name, it will be used as default suggested file name in the dialog |
FileFilter |
String |
No |
String expression representing file filters |
DafaultExtension |
String |
No |
Default extension to use |
Options |
Number |
No |
Remarks
In case of %OFN_ALLOWMULTISELECT option is active and multiple files are selected, returned string is a set of $NUL separated path files.
Use a parsing technique to parse returned string to get each single file name.
Restrictions
See also
Examples
USES "UI"
USES "File"
DIM sFile AS STRING
DIM sFilter AS STRING
sFilter = "thinBasic Files (*.tBasic, *.tBasicc)|*.tBasic;*.tBasicc|"
sFilter += "Basic Files (*.BAS, *.INC)|*.BAS;*.INC|"
sFilter += "Resource Files (*.RC)|*.RC|"
sFilter += "Help files (*.HLP)|*.HLP|"
sFilter += "Text Files (*.TXT)|*.TXT|"
sFilter += "Word processing (*.RTF)|*.RTF|"
sFilter += "All Files (*.*)|*.*"
sFile = Dialog_OpenFile(0, _
"Open a file", _
DIR_GetCurrent, _
sFilter, _
"tBasic", _
%OFN_FILEMUSTEXIST OR %OFN_HIDEREADONLY or %OFN_ENABLESIZING)
MSGBOX 0, sFile